Part Number Hot Search : 
HMC31402 FZ44VZ RLZ30 4ALVCH16 2SA17 KSS138 6SPR01 TK65218
Product Description
Full Text Search
 

To Download TMP86FS28FG Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  8 bit microcontroller tlcs-870/c series TMP86FS28FG
the information contained herein is subject to change without notice. 021023_d toshiba is continually working to improve the qua lity and reliability of its products. nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. it is the responsibility of the buyer, when utiliz ing toshiba products, to comply with the standards of safety in making a safe design for the entire sy stem, and to avoid situations in which a malfunction or failure of such toshiba products could cause loss of human life, bodily injury or damage to property. in developing your designs, please ensure that toshiba products are used within specified operating ranges as set forth in the most r ecent toshiba products specifications. also, please keep in mind the precauti ons and conditions set forth in the ? handling guide for semiconductor devices, ? or ? toshiba semiconductor reliability handbook ? etc. 021023_a the toshiba products listed in this document are intended for usage in general electronics applications (computer, personal equipment, of fice equipment, measuring equipment, industrial robotics, domestic appliances, etc.). these toshiba products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunction or failure of which may cause loss of human life or bodily injury ( ? unintended usage ? ). unintended usage include atomic energy control instruments, airplane or spaceship instruments, transportation in struments, traffic signal instruments, combustion control instruments, medical instrument s, all types of safety devices, etc. unintended usage of toshiba products listed in this document shall be made at the customer's own risk. 021023_b the products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohib ited under any applicable laws and regulations. 060106_q the information contained herein is presented only as a guide for the applications of our products. no responsibility is assumed by toshiba for any infring ements of patents or other rights of the third parties which may result from its use. no license is granted by implication or otherwise under any patents or other rights of toshiba or the third parties. 070122_c the products described in this document are subject to foreign exchange and foreign trade control laws. 060925_e for a discussion of how the reliability of microcontro llers can be predicted, please refer to section 1.3 of the chapter entitled quality and reliabil ity assurance/handling precautions. 030619_s ? 2007 toshiba corporation all rights reserved
revision history date revision 2006/2/9 tentative 1 first release 2006/3/6 tentative 2 first release 2006/4/13 1 first release 2006/6/29 2 periodical updating.no change in contents. 2006/9/28 3 contents revised 2007/7/23 4 contents revised

i table of contents TMP86FS28FG 1.1 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 pin names and functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2. operational description 2.1 cpu core functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.1 memory address map ............................................................................................................................... 9 2.1.2 program memory (flash) .......................................................................................................................... 9 2.1.3 data memory (ram) ............................................................................................................................... .. 9 2.2 system clock controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2.1 clock generator ............................................................................................................................... ....... 10 2.2.2 timing generator ............................................................................................................................... ..... 12 2.2.2.1 configuration of timing generator 2.2.2.2 machine cycle 2.2.3 operation mode control circuit .............................................................................................................. 13 2.2.3.1 single-clock mode 2.2.3.2 dual-clock mode 2.2.3.3 stop mode 2.2.4 operating mode control ......................................................................................................................... 18 2.2.4.1 stop mode 2.2.4.2 idle1/2 mode and sleep1/2 mode 2.2.4.3 idle0 and sleep0 modes (idle0, sleep0) 2.2.4.4 slow mode 2.3 reset circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2.3.1 external reset input ............................................................................................................................... 31 2.3.2 address trap reset ............................................................................................................................... ... 32 2.3.3 watchdog timer reset .............................................................................................................................. 32 2.3.4 system clock reset ............................................................................................................................... ... 32 3. interrupt control circuit 3.1 interrupt latches (il29 to il2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.2 interrupt enable register (eir) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.2.1 interrupt master enable flag (imf) .......................................................................................................... 36 3.2.2 individual interrupt enable flags (ef29 to ef4) ...................................................................................... 37 note 3: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.3 interrupt sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.3.1 interrupt acceptance processing is packaged as follows. ....................................................................... 39 3.3.2 saving/restoring general-purpose registers ............................................................................................ 40 3.3.2.1 using push and pop instructions 3.3.2.2 using data transfer instructions 3.3.3 interrupt return ............................................................................................................................... ......... 41 3.4 software interrupt (intsw) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.4.1 address error detection .......................................................................................................................... 42 3.4.2 debugging ............................................................................................................................... ............... 42
ii 3.5 undefined instruction interrupt (intundef) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.6 address trap interrupt (intatrap) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.7 external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4. special function r egister (sfr) 4.1 sfr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 4.2 dbr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5. i/o ports 5.1 port p0 (p00 to p02) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5.2 port p1 (p10 to p17) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.3 port p2 (p20 to p22) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 5.4 port p3 (p30 to p37) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 5.5 port p4 (p40 to p47) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 5.6 port p5 (p50 to p57) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 5.7 port p6 (p60 to p67) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 5.8 port p7 (p70 to p77) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.9 port p8 (p80 to p87) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 6. watchdog timer (wdt) 6.1 watchdog timer configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 6.2 watchdog timer control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 6.2.1 malfunction detection methods using the watchdog timer ................................................................... 72 6.2.2 watchdog timer enable ......................................................................................................................... 73 6.2.3 watchdog timer disable ........................................................................................................................ 74 6.2.4 watchdog timer interrupt (intwdt) ...................................................................................................... 74 6.2.5 watchdog timer reset ........................................................................................................................... 75 6.3 address trap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 6.3.1 selection of address trap in internal ram (atas) ................................................................................ 76 6.3.2 selection of operation at address trap (atout) .................................................................................. 76 6.3.3 address trap interrupt (intatrap) ....................................................................................................... 76 6.3.4 address trap reset ............................................................................................................................... . 77 7. time base timer (tbt) 7.1 time base timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 7.1.1 configuration ............................................................................................................................... ........... 79 7.1.2 control ............................................................................................................................... ..................... 79 7.1.3 function ............................................................................................................................... ................... 80 7.2 divider output (dvo) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 7.2.1 configuration ............................................................................................................................... ........... 81 7.2.2 control ............................................................................................................................... ..................... 81 8. 16-bit timercoun ter (tc10,tc11) 8.1 16-bit timercounter 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
iii 8.1.1 configuration ............................................................................................................................... ........... 83 8.1.2 timercounter control ............................................................................................................................. 8 4 8.1.3 function ............................................................................................................................... ................... 85 8.1.3.1 timer mode 8.1.3.2 external trigger timer mode 8.1.3.3 event counter mode 8.1.3.4 window mode 8.1.3.5 pulse width measurement mode 8.1.3.6 programmable pulse generate (ppg) output mode 8.2 16-bit timercounter 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 8.2.1 configuration ............................................................................................................................... ........... 97 8.2.2 timercounter control ............................................................................................................................. 9 8 8.2.3 function ............................................................................................................................... ................... 99 8.2.3.1 timer mode 8.2.3.2 external trigger timer mode 8.2.3.3 event counter mode 8.2.3.4 window mode 8.2.3.5 pulse width measurement mode 8.2.3.6 programmable pulse generate (ppg) output mode 9. 8-bit timercounter (tc3, tc4) 9.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 9.2 timercounter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 9.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 9.3.1 8-bit timer mode (tc3 and 4) .............................................................................................................. 117 9.3.2 8-bit event counter mode (tc3, 4) ...................................................................................................... 118 9.3.3 8-bit programmable divider ou tput (pdo) mode (tc3, 4) ................................................................... 118 9.3.4 8-bit pulse width modulation (pwm) output mode (tc3, 4) ................................................................ 121 9.3.5 16-bit timer mode (tc3 and 4) ............................................................................................................ 123 9.3.6 16-bit event counter mode (tc3 and 4) .............................................................................................. 124 9.3.7 16-bit pulse width modulation (pwm) output mode (tc3 and 4) ........................................................ 124 9.3.8 16-bit programmable pulse generate (ppg) output mode (tc3 and 4) ............................................. 127 9.3.9 warm-up counter mode ....................................................................................................................... 129 9.3.9.1 low-frequency warm-up counter mode (normal1 normal2 slow2 slow1) 9.3.9.2 high-frequency warm-up counter mode (slow1 slow2 normal2 normal1) 10. 8-bit timercounter (tc5, tc6) 10.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 10.2 timercounter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 10.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 10.3.1 8-bit timer mode (tc5 and 6) ............................................................................................................ 137 10.3.2 8-bit event counter mode (tc5, 6) .................................................................................................... 138 10.3.3 8-bit programmable divider output (pdo) mode (tc5, 6) ................................................................. 138 10.3.4 8-bit pulse width modulation (pwm) output mode (tc5, 6) .............................................................. 141 10.3.5 16-bit timer mode (tc5 and 6) .......................................................................................................... 143 10.3.6 16-bit event counter mode (tc5 and 6) ............................................................................................ 144 10.3.7 16-bit pulse width modulation (pwm) output mode (tc5 and 6) ...................................................... 144 10.3.8 16-bit programmable pulse generate (ppg) output mode (tc5 and 6) ........................................... 147 10.3.9 warm-up counter mode ..................................................................................................................... 149 10.3.9.1 low-frequency warm-up counter mode (normal1 normal2 slow2 slow1) 10.3.9.2 high-frequency warm-up counter mode (slow1 slow2 normal2 normal1) 11. synchronous serial interface (sio) 11.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
iv 11.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 11.3 serial clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 11.3.1 clock source ............................................................................................................................... ........ 153 11.3.1.1 internal clock 11.3.1.2 external clock 11.3.2 shift edge ............................................................................................................................... ............. 155 11.3.2.1 leading edge 11.3.2.2 trailing edge 11.4 number of bits to transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 11.5 number of words to transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 11.6 transfer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 11.6.1 4-bit and 8-bit transfer modes ............................................................................................................. 156 11.6.2 4-bit and 8-bit receive modes ............................................................................................................. 158 11.6.3 8-bit transfer / receive mode ............................................................................................................... 159 12. asynchronous serial interface (uart1 ) 12.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 12.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 12.3 transfer data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 12.4 transfer rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 12.5 data sampling method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 12.6 stop bit length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 12.7 parity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 12.8 transmit/receive operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 12.8.1 data transmit operation .................................................................................................................... 166 12.8.2 data receive operation ..................................................................................................................... 166 12.9 status flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 12.9.1 parity error ............................................................................................................................... ........... 167 12.9.2 framing error ............................................................................................................................... ....... 167 12.9.3 overrun error ............................................................................................................................... ....... 167 12.9.4 receive data buffer full ..................................................................................................................... 168 12.9.5 transmit data buffer empty ............................................................................................................... 168 12.9.6 transmit end flag .............................................................................................................................. 169 13. asynchronous serial interface (uart0 ) 13.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 13.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 13.3 transfer data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 13.4 transfer rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 13.5 data sampling method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 13.6 stop bit length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 13.7 parity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 13.8 transmit/receive operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 13.8.1 data transmit operation .................................................................................................................... 176 13.8.2 data receive operation ..................................................................................................................... 176 13.9 status flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 13.9.1 parity error ............................................................................................................................... ........... 177 13.9.2 framing error ............................................................................................................................... ....... 177 13.9.3 overrun error ............................................................................................................................... ....... 177 13.9.4 receive data buffer full ..................................................................................................................... 178 13.9.5 transmit data buffer empty ............................................................................................................... 178 13.9.6 transmit end flag .............................................................................................................................. 179
v 14. 10-bit ad converter (adc) 14.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 14.2 register configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 14.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 14.3.1 software start mode ........................................................................................................................... 185 14.3.2 repeat mode ............................................................................................................................... ....... 185 14.3.3 register setting ............................................................................................................................... . 186 14.4 stop/slow modes during ad conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 14.5 analog input voltage and ad conversion result . . . . . . . . . . . . . . . . . . . . . . . 188 14.6 precautions about ad converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 14.6.1 analog input pin voltage range ........................................................................................................... 189 14.6.2 analog input shared pins .................................................................................................................... 189 14.6.3 noise countermeasure ....................................................................................................................... 189 15. key-on wakeup (kwu) 15.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 15.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 15.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 16. lcd driver 16.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 16.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 16.2.1 lcd driving methods .......................................................................................................................... 195 16.2.2 frame frequency ............................................................................................................................... .. 196 16.2.3 driving method for lcd driver ............................................................................................................ 197 16.2.3.1 when using the booster circuit (lcdcr="1") 16.2.3.2 when using an external resistor divider (lcdcr="0") 16.3 lcd display operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 16.3.1 display data setting ............................................................................................................................ 19 9 16.3.2 blanking ............................................................................................................................... ............... 200 16.4 control method of lcd driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 16.4.1 initial setting ............................................................................................................................... ......... 201 16.4.2 store of display data ........................................................................................................................... 201 16.4.3 example of lcd drive output .............................................................................................................. 204 17. flash memory 17.1 flash memory control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 17.1.1 flash memory command sequence execution control (flscr) ..................................... 210 17.1.2 flash memory bank select control (flscr) ................................................................ 210 17.1.3 flash memory standby control (flsstb) ............................................................................ 211 17.2 command sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 17.2.1 byte program ............................................................................................................................... ....... 212 17.2.2 sector erase (4-kbyte erase) ............................................................................................................. 212 17.2.3 chip erase (all erase) ........................................................................................................................ 213 17.2.4 product id entry ............................................................................................................................... .. 213 17.2.5 product id exit ............................................................................................................................... ..... 213 17.2.6 read protect ............................................................................................................................... ........ 213 17.3 toggle bit (d6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 17.4 access to the flash memory area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
vi 17.4.1 flash memory control in the serial prom mode ............................................................................... 215 17.4.2 flash memory control in the mcu mode ............................................................................................ 216 17.4.2.1 how to write to the flash memory by executing a user write control program in the ram area (in the mcu mode) 18. serial prom mode 18.1 outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 18.2 memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 18.3 serial prom mode setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 18.3.1 serial prom mode control pins ........................................................................................................ 220 18.3.2 pin function ............................................................................................................................... ......... 220 18.3.3 example connection for on-board writing ......................................................................................... 221 18.3.4 activating the serial prom mode ...................................................................................................... 222 18.4 interface specifications for uart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 18.5 operation command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 18.6 operation mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 18.6.1 flash memory erasing mode (operating command: f0h) ................................................................. 226 18.6.2 flash memory writing mode (operation command: 30h) .................................................................. 228 18.6.3 flash memory sum output mode (operation command: 90h) ......................................................... 231 18.6.4 product id code output mode (operation command: c0h) .............................................................. 232 18.6.5 flash memory status output mode (operation command: c3h) ...................................................... 234 18.6.6 flash memory read protection setting mode (operation command: fah) ...................................... 235 18.7 error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 18.8 checksum (sum) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 18.8.1 calculation method ............................................................................................................................. 2 37 18.8.2 calculation data ............................................................................................................................... ... 238 18.9 intel hex format (binary) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 18.10 passwords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 18.10.1 password string ............................................................................................................................... . 240 18.10.2 handling of password error .............................................................................................................. 240 18.10.3 password management during program development .................................................................... 240 18.11 product id code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 18.12 flash memory status code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 18.13 specifying the erasure area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 18.14 flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 18.15 uart timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 19. input/output circuitry 19.1 control pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 19.2 input/output ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 20. electrical characteristics 20.1 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 20.2 operating condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 20.2.1 mcu mode (flash programming or erasing) ..................................................................................... 250 20.2.2 mcu mode (except flash progra mming or erasing) ......................................................................... 250 20.2.3 serial prom mode ............................................................................................................................. 2 51 20.3 dc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 20.4 ad conversion characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 20.5 ac characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 20.6 flash characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
vii 20.7 recommended oscillating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 20.8 handling precaution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 21. package dimensions this is a technical docu ment that describes the operat ing functions and electrical specifications of the 8-bit microc ontroller series tlcs-870/c (lsi).
viii
page 1 TMP86FS28FG cmos 8-bit microcontroller ? the information contained herein is subject to change without notice. 021023_d ? toshiba is continually working to improve the quality and reli ability of its products. neverthel ess, semiconductor devices in general can malfunction or fail due to their inherent el ectrical sensitivity and vul nerability to physical stre ss. it is the responsibility of the buyer, when utilizing toshiba products, to comply with the standards of sa fety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such toshiba products could cause loss of human life, bodily injury or damage to property. in developing your designs, pleas e ensure that toshiba products are used within specified operating ranges as set forth in the most recent toshiba products specifications. also, please keep in mind the precautions and conditions set forth in the ?handling gui de for semiconductor devices,? or ?toshiba se miconductor reliability handbook? etc. 021023_a ? the toshiba products listed in this document are intended for usage in general electronics applic ations (computer, personal eq uip- ment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.). these toshiba products are neithe r intended nor warranted for usage in equipment that requires extr aordinarily high quality and/or re liability or a malfunctionor failure of which may cause loss of human life or bod ily injury (?unintended usage?). unintended us age include atomic energy control instru ments, airplane or spaceship instruments, transporta tion instruments, traffic signal instrume nts, combustion control instruments, medi cal instru- ments, all types of safety dev ices, etc. unintended usage of toshiba products li sted in this document shall be made at the cust omer's own risk. 021023_b ? the products described in this document shall not be used or embedded to any downstream products of which manufacture, use and /or sale are prohibited under any appl icable laws and regulations. 060106_q ? the information contained herein is present ed only as a guide for the applications of our products. no responsibility is assum ed by toshiba for any infringements of patents or other rights of the th ird parties which may result from its use. no license is gran ted by impli- cation or otherwise under any patent s or other rights of toshiba or the third parties. 070122_c ? the products described in this document are subjec t to foreign exchange and foreign trade control laws. 060925_e ? for a discussion of how the reliability of microcontrollers c an be predicted, please refer to section 1.3 of the chapter entit led quality and reliability assurance/h andling precautions. 030619_s this product uses the super flash ? technology under the licence of silicon storage technology, inc. super flash ? is registered trademark of silicon storage technology, inc. TMP86FS28FG the TMP86FS28FG is a single-chip 8-bit high-speed a nd high-functionality microcomputer incorporating 61440 bytes of flash memory. it is pin-compatible with the tmp86cs28fg (mask rom version). the TMP86FS28FG can realize operations equivalent to those of the tmp86cs28fg by programming the on-chip flash memory. 1.1 features 1. 8-bit single chip microcomputer tlcs-870/c series - instruction execution time : 0.25 s (at 16 mhz) 122 s (at 32.768 khz) - 132 types & 731 basic instructions 2. 23interrupt sources (external : 6 internal : 17) 3. input / output ports (62 pins) 4. watchdog timer 5. prescaler - time base timer - divider output function 6. 16-bit timer counter: 2 ch - timer, external trigger, wi ndow, pulse width measurement, event counter, programmable pulse generate (ppg) modes 7. 8-bit timer counter : 4 ch - timer, event counter, programmable divider output (pdo), pulse width modulation (pwm) output, programmable pulse generation (ppg) modes product no. rom (flash) ram package mask rom mcu emulation chip TMP86FS28FG 61440 bytes 2048 bytes qfp80-p-1420-0.80b tmp86cs28fg tmp86c989xb
page 2 1.1 features TMP86FS28FG 8. 8-bit uart/sio: 1 ch 9. 8-bit uart : 1 ch 10. 10-bit successive approximation type ad converter - analog input: 8 ch 11. key-on wakeup : 4 ch 12. lcd driver/controller built-in voltage booster for lcd driver with display memory lcd direct drive capability (max 40 seg u 4 com) 1/4,1/3,1/2duties or static drive are programmably selectable 13. clock operation single clock mode dual clock mode 14. low power consumption operation stop mode: oscillation stops. (battery/capacitor back-up.) slow1 mode: low power consumption operation usin g low-frequency clock.(high-frequency clock stop.) slow2 mode: low power consumption operation usin g low-frequency clock.(high-frequency clock oscillate.) idle0 mode: cpu stops, and only the time-based-tim er(tbt) on peripherals operate using high fre- quency clock. release by falling edge of th e source clock which is set by tbtcr. idle1 mode: cpu stops and peripherals operate us ing high frequency clock. release by interru- puts(cpu restarts). idle2 mode: cpu stops and peripherals operate usin g high and low frequency clock. release by inter- ruputs. (cpu restarts). sleep0 mode: cpu stops, and only the time-based-t imer(tbt) on peripherals operate using low fre- quency clock.release by falling edge of th e source clock which is set by tbtcr. sleep1 mode: cpu stops, and peripherals operate using low frequency clock. release by interru- put.(cpu restarts). sleep2 mode: cpu stops and peripherals operate using high and low frequency clock. release by interruput. 15. wide operation voltage: 2.7 v to 5.5 v at 8 mhz /32.768 khz 4.0 v to 5.5 v at 16 mhz /32.768 khz
page 3 TMP86FS28FG 1.2 pin assignment figure 1-1 pin assignment 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 vss xout test vdd (xtin) p21 (xtout) p22 reset ( int5 / stop ) p20 p00 (int3/ ppg10 ) p02 varef avdd (ain0) p10 (ain1) p11 (stop2/ain2) p12 (stop3/ain3) p13 (stop4/ain4) p14 (stop5/ain5) p15 (ain6) p16 ( int0 ) p30 avss p31( dvo ) p33 p34(so/rxd1) p36( sck ) p35(si/txd1) p50 (seg31/txd0) p47 (seg32) p46 (seg33) p45 (seg34) p44 (seg35) p43 (seg36/tc11) p42 (seg37/ ppg11 ) p41 (seg38/int2) p40 (seg39/int1) p37 (tc10/int4) p32 p62 (seg21) p61 (seg22) p60 (seg23) p57 (seg24) p56 (seg25) p55 (seg26/tc6/ pdo6/pwm6/ppg6 ) p54 (seg27/tc5/ pdo5/pwm5 ) p53 (seg28/tc4/ pdo4/pwm4/ppg4 ) p52 (seg29/tc3/ pdo3/pwm3 ) p51 (seg30/rxd0) p75 (seg10) p80 (seg7) p77 (seg8) p76 (seg9) p74 (seg11) p73 (seg12) p72 (seg13) p71 (seg14) p70 (seg15) p67 (seg16) p66 (seg17) p65 (seg18) p64 (seg19) p63 (seg20) (ain7) p17 p01 xin (seg6) p81 (seg5) p82 (seg4) p83 (seg3) p84 (seg1) p86 (seg0) p87 com3 com2 com1 com0 v3 v2 v1 c1 c0 (seg2) p85
page 4 1.3 block diagram TMP86FS28FG 1.3 block diagram figure 1-2 block diagram
page 5 TMP86FS28FG 1.4 pin names and functions the TMP86FS28FG has mcu mode, parallel prom mode , and serial prom mode. table 1-1 shows the pin functions in mcu mode. the serial prom mode is explained later in a separate chapter. table 1-1 pin names and functions(1/4) pin name pin number input/output functions p02 ppg10 int3 12 io o i port02 ppg10 output external interrupt 3 input p01 11 io port01 p00 10 io port00 p17 ain7 22 io i port17 analog input7 p16 ain6 21 io i port16 analog input6 p15 ain5 stop5 20 io i i port15 analog input5 stop5 input p14 ain4 stop4 19 io i i port14 analog input4 stop4 input p13 ain3 stop3 18 io i i port13 analog input3 stop3 input p12 ain2 stop2 17 io i i port12 analog input2 stop2 input p11 ain1 16 io i port11 analog input1 p10 ain0 15 io i port10 analog input0 p22 xtout 7 io o port22 resonator connecting pins(32.768 khz) for inputting external clock p21 xtin 6 io i port21 resonator connecting pins(32.768 khz) for inputting external clock p20 stop int5 9 io i i port20 stop mode release signal input external interrupt 5 input p37 tc10 int4 31 io i i port37 tc10 input external interrupt 4 input p36 sck 30 io io port36 serial clock i/o p35 si txd1 29 io i o port35 serial data input uart data output 1 p34 so rxd1 28 io o i port34 serial data output uart data input 1
page 6 1.4 pin names and functions TMP86FS28FG p33 27 io port33 p32 26 io port32 p31 dvo 25 io o port31 divider output p30 int0 24 io i port30 external interrupt 0 input p47 seg32 39 io o port47 lcd segment output 32 p46 seg33 38 io o port46 lcd segment output 33 p45 seg34 37 io o port45 lcd segment output 34 p44 seg35 36 io o port44 lcd segment output 35 p43 seg36 tc11 35 io o i port43 lcd segment output 36 tc11 input p42 seg37 ppg11 34 io o o port42 lcd segment output 37 ppg11 output p41 seg38 int2 33 io o i port41 lcd segment output 38 external interrupt 2 input p40 seg39 int1 32 io o i port40 lcd segment output 39 external interrupt 1 input p57 seg24 47 io o port57 lcd segment output 24 p56 seg25 46 io o port56 lcd segment output 25 p55 seg26 tc6 pdo6/pwm6/ppg6 45 io o i o port55 lcd segment output 26 tc6 input pdo6/pwm6/ppg6 output p54 seg27 tc5 pdo5/pwm5 44 io o i o port54 lcd segment output 27 tc5 input pdo5/pwm5 output p53 seg28 tc4 pdo4/pwm4/ppg4 43 io o i o port53 lcd segment output 28 tc4 input pdo4/pwm4/ppg4 output p52 seg29 tc3 pdo3/pwm3 42 io o i o port52 lcd segment output 29 tc3 input p51 seg30 rxd0 41 io o i port51 lcd segment output 30 uart data input 0 table 1-1 pin names and functions(2/4) pin name pin number input/output functions
page 7 TMP86FS28FG p50 seg31 txd0 40 io o o port50 lcd segment output 31 uart data output 0 p67 seg16 55 io o port67 lcd segment output 16 p66 seg17 54 io o port66 lcd segment output 17 p65 seg18 53 io o port65 lcd segment output 18 p64 seg19 52 io o port64 lcd segment output 19 p63 seg20 51 io o port63 lcd segment output 20 p62 seg21 50 io o port62 lcd segment output 21 p61 seg22 49 io o port61 lcd segment output 22 p60 seg23 48 io o port60 lcd segment output 23 p77 seg8 63 io o port77 lcd segment output 8 p76 seg9 62 io o port76 lcd segment output 9 p75 seg10 61 io o port75 lcd segment output 10 p74 seg11 60 io o port74 lcd segment output 11 p73 seg12 59 io o port73 lcd segment output 12 p72 seg13 58 io o port72 lcd segment output 13 p71 seg14 57 io o port71 lcd segment output 14 p70 seg15 56 io o port70 lcd segment output 15 p87 seg0 71 io o port87 lcd segment output 0 p86 seg1 70 io o port86 lcd segment output 1 p85 seg2 69 io o port85 lcd segment output 2 p84 seg3 68 io o port84 lcd segment output 3 p83 seg4 67 io o port83 lcd segment output 4 p82 seg5 66 io o port82 lcd segment output 5 table 1-1 pin names and functions(3/4) pin name pin number input/output functions
page 8 1.4 pin names and functions TMP86FS28FG p81 seg6 65 io o port81 lcd segment output 6 p80 seg7 64 io o port80 lcd segment output 7 com3 72 o lcd common output 3 com2 73 o lcd common output 2 com1 74 o lcd common output 1 com0 75 o lcd common output 0 v3 76 i lcd voltage booster pin v2 77 i lcd voltage booster pin v1 78 i lcd voltage booster pin c1 79 i lcd voltage booster pin c0 80 i lcd voltage booster pin xin 2 i resonator connecting pins for high-frequency clock xout 3 o resonator connecting pins for high-frequency clock reset 8 i reset signal test 4 i test pin for out-going test. normally, be fixed to low. varef 14 i analog base voltage input pin for a/d conversion avdd 13 i analog power supply avss 23 i analog power supply vdd 5 i +5v vss 1 i 0(gnd) table 1-1 pin names and functions(4/4) pin name pin number input/output functions
page 9 TMP86FS28FG 2. operational description 2.1 cpu core functions the cpu core consists of a cpu, a system cl ock controller, and an interrupt controller. this section provides a description of the cpu core, the program memory, the data memory, and the reset circuit. 2.1.1 memory address map the TMP86FS28FG memory is composed flash, ram, dbr(data buffer register) and sfr(special func- tion register). they are all mapped in 64-kbyte address space. figure 2-1 shows the TMP86FS28FG figure 2-1 memory address map 2.1.2 program memory (flash) the TMP86FS28FG has a 61440 bytes (address 1000h to ffffh) of program memory (flash ). 2.1.3 data memory (ram) the TMP86FS28FG has 2048 bytes (address 0040h to 083fh) of internal ram. the first 192 bytes (0040h to 00ffh) of the internal ra m are located in the direct area; inst ructions with shorten operations are available against such an area. sfr 0000 h 64 bytes sfr: ram: special function register includes: i/o ports peripheral control registers peripheral status registers system control registers program status word random access memory includes: data memory stack 003f h ram 0040 h 2048 bytes 083f h dbr 0f00 h 256 bytes dbr: data buffer register includes: peripheral control registers peripheral status registers lcd display memory 0fff h 1000 h flash: program memory flash 61440 bytes ffa0 h vector table for interrupts (32 bytes) ffbf h ffc0 h vector table for vector call instructions (32 bytes) ffdf h ffe0 h vector table for interrupts (32 bytes) ffff h
page 10 2. operational description 2.2 system clock controller TMP86FS28FG the data memory contents become un stable when the power supply is turned on; therefore, the data memory should be initialized by an initialization routine. 2.2 system clock controller the system clock controller consists of a clock generator, a timing generator, and a standby controller. figure 2-2 syst em colck control 2.2.1 clock generator the clock generator generates the basic clock which pr ovides the system clocks supplied to the cpu core and peripheral hardware. it contains two oscillation ci rcuits: one for the high-frequency clock and one for the low-frequency clock. power consumption can be reduced by switching of the standby controller to low-power operation based on the low-frequency clock. the high-frequency (fc) clock and low-frequency (fs) clock can easily be obtained by connecting a resonator between the xin/xout and xtin/xtout pins respectively. clock input from an exte rnal oscillator is also possible. in this case, external clock is applied to xin/xtin pin with xout/xtout pin not connected. example :clears ram to ?00h?. (TMP86FS28FG) ld hl, 0040h ; start address setup ld a, h ; initial value (00h) setup ld bc, 07ffh sramclr: ld (hl), a inc hl dec bc jrs f, sramclr tbtcr syscr2 syscr1 xin xout xtin xtout fc 0036 h 0038 h 0039 h fs timing generator control register timing generator standby controller system clocks clock generator control high-frequency clock oscillator low-frequency clock oscillator clock generator system control registers
page 11 TMP86FS28FG figure 2-3 examples of resonator connection note:the function to monitor the basic clock directly at external is not provided for hardware, however, with dis- abling all interrupts and watchdog timers, the oscillation frequency can be adjusted by monitoring the pulse which the fixed frequency is outputted to the port by the program. the system to require the adjustment of the oscilla tion frequency should create the program for the adjust- ment in advance. xout xin (open) xout xin xtout xtin (open) xtout xtin (a) crystal/ceramic resonator (b) external oscillator (c) crystal (d) external oscillator high-frequency clock low-frequency clock
page 12 2. operational description 2.2 system clock controller TMP86FS28FG 2.2.2 timing generator the timing generator generates the various system cloc ks supplied to the cpu core and peripheral hardware from the basic clock (fc or fs). the timing generator provides the following functions. 1. generation of main system clock 2. generation of divider output ( dvo ) pulses 3. generation of source clocks for time base timer 4. generation of source clocks for watchdog timer 5. generation of internal source clocks for timer/counters 6. generation of warm-up clocks for releasing stop mode 7. lcd 2.2.2.1 configuration of timing generator the timing generator consists of a 2-stage prescaler, a 21-stage divider, a main system clock generator, and machine cycle counters. an input clock to the 7th stage of the divider depends on the operating mode, syscr2 and tbtcr, that is shown in figure 2-4. as reset and stop mode star ted/canceled, the prescaler and the divider are cleared to ?0?. figure 2-4 configurat ion of timing generator multi- plexer high-frequency clock fc low-frequency clock fs divider sysck fc/4 fc or fs machine cycle counters main system clock generator 1 2 1 4 3 2 8 7 10 9 12 11 14 13 16 15 dv7ck multiplexer warm-up controller watchdog timer a s b y s b0 a0 y0 b1 a1 y1 5 6 17 18 19 20 21 timer counter, serial interface, time-base-timer, divider output, etc. (peripheral functions)
page 13 TMP86FS28FG note 1: in single clock mode, do not set dv7ck to ?1?. note 2: do not set ?1? on dv7ck while the low-frequency clock is not operated stably. note 3: fc: high-frequency clock [hz], fs : low-frequency clock [hz], *: don?t care note 4: in slow1/2 and sleep1/2 modes, the dv7ck setting is ineffective, and fs is input to the 7th stage of the divider. note 5: when stop mode is entered from normal1/2 mode, the dv 7ck setting is ineffective during the warm-up period after release of stop mode, and the 6th stage of the divider is input to the 7th stage during this period. 2.2.2.2 machine cycle instruction execution and peripheral hardware operat ion are synchronized with the main system clock. the minimum instruction execution uni t is called an ?machine cycle?. th ere are a total of 10 different types of instructions for the tlcs-870/c series: ra nging from 1-cycle instructions which require one machine cycle for execution to 10-cyc le instructions which require 10 machine cycles fo r execution. a machine cycle consists of 4 states (s0 to s3), and each state consists of one main system clock. figure 2-5 machine cycle 2.2.3 operation mode control circuit the operation mode control circuit starts and stops th e oscillation circuits for the high-frequency and low- frequency clocks, and switches the main system clock. there are three operating modes: single clock mode, dual clock mode and stop mode. these modes are cont rolled by the system cont rol registers (syscr1 and syscr2). figure 2-6 shows the operating mode transition diagram. 2.2.3.1 single-clock mode only the oscillation circuit for the high-frequenc y clock is used, and p21 (xtin) and p22 (xtout) pins are used as input/output ports . the main-system clock is obtained from the high-frequency clock. in the single-clock mode, the machine cycle time is 4/fc [s]. (1) normal1 mode in this mode, both the cpu core and on-chip pe ripherals operate using the high-frequency clock. the TMP86FS28FG is placed in this mode after reset. timing generator control register tbtcr (0036h) 76543210 (dvoen) (dvock) dv7ck (tbten) (tbtck) (initial value: 0000 0000) dv7ck selection of input to the 7th stage of the divider 0: fc/2 8 [hz] 1: fs r/w main system clock state machine cycle s3 s2 s1 s0 s3 s2 s1 s0 1/fc or 1/fs [s]
page 14 2. operational description 2.2 system clock controller TMP86FS28FG (2) idle1 mode in this mode, the internal oscillation circuit remains active. the cpu and the watchdog timer are halted; however on-chip peripherals remain active (operate using the high-frequency clock). idle1 mode is started by syscr2 = "1", and idle1 mode is released to normal1 mode by an interrupt request from the on-chip peri pherals or external interrupt inputs. when the imf (interrupt master enable flag) is ?1? (interrupt enable), the execution will resume with the acceptance of the interrupt, and the operation will return to nor mal after the interrupt service is completed. when the imf is ?0? (interrupt disable), the execution will resume with the instruction which follows the idle1 mode start instruction. (3) idle0 mode in this mode, all the circuit, except oscillator an d the timer-base-timer, stops operation. this mode is enabled by syscr2 = "1". when idle0 mode starts, the cpu stops and the timing generator stops feeding the clock to the peripheral circuits other than tbt. then, upon de tecting the falling edge of the source clock selected with tbtcr, the timing generator starts feeding the clock to al l peripheral circuits. when returned from idle0 mode, the cpu rest arts operating, entering normal1 mode back again. idle0 mode is entered and returned regardless of how tbtcr is set. when imf = ?1?, ef6 (tbt interrupt individu al enable flag) = ?1?, and tb tcr = ?1?, interrupt pro- cessing is performed. when idle0 mode is entered while tbtcr = ?1?, the inttbt interrupt latch is set after returning to normal1 mode. 2.2.3.2 dual-clock mode both the high-frequency and low-frequency oscillatio n circuits are used in th is mode. p21 (xtin) and p22 (xtout) pins cannot be used as input/output ports. the main system clock is obtained from the high-frequency clock in normal2 and idle2 modes, and is obtained from the low-frequency clock in slow and sleep modes. th e machine cycle time is 4/fc [s] in the normal2 and idle2 modes, and 4/fs [s] (122 p s at fs = 32.768 khz) in the slow and sleep modes. the tlcs-870/c is placed in the signal-clock mode during reset. to use the dual-clock mode, the low- frequency oscillator should be turned on at the start of a program. (1) normal2 mode in this mode, the cpu core operates with the high-frequency clock. on-chip peripherals operate using the high-frequency clock and/or low-frequency clock. (2) slow2 mode in this mode, the cpu core operates with the lo w-frequency clock, while both the high-frequency clock and the low-frequency clock are operated. as the syscr2 becomes "1", the hard- ware changes into slow2 mode. as the syscr2 becomes ?0?, the hardware changes into normal2 mode. as the syscr2 beco mes ?0?, the hardware changes into slow1 mode. do not clear syscr2 to ?0? during slow2 mode. (3) slow1 mode this mode can be used to reduce power-consu mption by turning off oscillation of the high-fre- quency clock. the cpu core and on-chip peri pherals operate using th e low-frequency clock.
page 15 TMP86FS28FG switching back and forth between slow1 and slow2 modes are performed by syscr2. in slow1 and sleep modes, the input clock to the 1st stage of the divider is stopped; output from the 1st to 6th stages is also stopped. (4) idle2 mode in this mode, the internal oscillation circuit remain active. the cpu and the watchdog timer are halted; however, on-chip peripherals remain activ e (operate using the high-frequency clock and/or the low-frequency clock). starting and releasing of idle2 mode are the same as for idle1 mode, except that operation re turns to normal2 mode. (5) sleep1 mode in this mode, the internal oscillation circuit of the low-frequency clock remains active. the cpu, the watchdog timer, and the internal oscillation circuit of the high-frequency clock are halted; how- ever, on-chip peripherals remain active (operate us ing the low-frequency clock). starting and releas- ing of sleep mode are the same as for idle1 mo de, except that operation returns to slow1 mode. in slow1 and sleep1 modes, the input clock to the 1st stage of the divider is stopped; output from the 1st to 6th stages is also stopped. (6) sleep2 mode the sleep2 mode is the idle mode corresponding to the slow2 mode. the status under the sleep2 mode is same as that under the sleep1 mo de, except for the oscilla tion circuit of the high- frequency clock. (7) sleep0 mode in this mode, all the circuit, except oscillator and the timer-base-timer, stops operation. this mode is enabled by setting ?1? on bit syscr2. when sleep0 mode starts, the cp u stops and the timing generator stops feeding the clock to the peripheral circuits other than tbt. then, upon de tecting the falling edge of the source clock selected with tbtcr, the timing generator starts feeding the clock to al l peripheral circuits. when returned from sleep0 mode, the cpu restarts operating, entering slow1 mode back again. sleep0 mode is entered and returned re gardless of how tbtcr is set. when imf = ?1?, ef6 (tbt interrupt individual enable flag ) = ?1?, and tbtcr = ?1?, interrupt pro- cessing is performed. when sleep0 mode is entered while tbtcr = ?1?, the inttbt interrupt latch is set after returning to slow1 mode. 2.2.3.3 stop mode in this mode, the internal oscillation circuit is turned off, causing all system operations to be halted. the internal status immediately prior to the halt is held with a lowest power consumption during stop mode. stop mode is started by the syst em control register 1 (syscr1), an d stop mode is released by a inputting (either level-sensitive or edge-sens itive can be programmably selected) to the stop pin. after the warm-up period is completed, the execution resumes with the instruction which follows the stop mode start instruction.
page 16 2. operational description 2.2 system clock controller TMP86FS28FG note 1: normal1 and normal2 modes are generically called no rmal; slow1 and slow2 are called slow; idle0, idle1 and idle2 are called idle; sleep0, sleep1 and sleep2 are called sleep. note 2: the mode is released by fa lling edge of tbtcr setting. figure 2-6 operating mode transition diagram table 2-1 operating mode and conditions operating mode oscillator cpu core tbt other peripherals machine cycle time high frequency low frequency single clock reset oscillation stop reset reset reset 4/fc [s] normal1 operate operate operate idle1 halt idle0 halt stop stop halt ? dual clock normal2 oscillation oscillation operate with high frequency operate operate 4/fc [s] idle2 halt slow2 operate with low frequency 4/fs [s] sleep2 halt slow1 stop operate with low frequency sleep1 halt sleep0 halt stop stop halt ? note 2 syscr2 = "1" stop pin input stop pin input stop pin input interrupt interrupt syscr2 = "0" syscr2 = "1" syscr2 = "0" syscr2 = "0" syscr1 = "1" syscr1 = "1" syscr1 = "1" syscr2 = "1" syscr2 = "1" interrupt syscr2 = "1" syscr2 = "1" interrupt syscr2 = "1" reset release normal1 mode idle0 mode (a) single-clock mode idle1 mode normal2 mode idle2 mode syscr2 = "1" slow2 mode sleep2 mode slow1 mode sleep1 mode sleep0 mode reset (b) dual-clock mode stop syscr2 = "1" note 2
page 17 TMP86FS28FG note 1: always set retm to ?0? when transiting from normal mode to stop mode. always set retm to ?1? when transiting from slow mode to stop mode. note 2: when stop mode is released with reset pin input, a return is made to normal1 regardless of the retm contents. note 3: fc: high-frequency clock [hz], fs : low-frequency clock [hz], *; don?t care note 4: bits 1 and 0 in syscr1 are read as undefined data when a read instruction is executed. note 5: as the hardware becomes stop mode under outen = ?0?, input value is fixed to ?0?; therefore it may cause external interrupt request on account of falling edge. note 6: when the key-on wakeup is used, relm should be set to "1". note 7: port p20 is used as stop pin. therefore, when stop mode is started, outen does not affect to p20, and p20 becomes high-z mode. note 8: the warmig-up time should be set correctly for using oscillator. note 1: a reset is applied if both xen and xten are cleared to ?0?, xen is cleared to ?0? when sysck = ?0?, or xten is cleared to ?0? when sysck = ?1?. note 2: *: don?t care, tg: timing generator, *; don?t care note 3: bits 3, 1 and 0 in syscr2 are always read as undefined value. note 4: do not set idle and tghalt to ?1? simultaneously. note 5: because returning from idle0/sleep0 to normal1/slow 1 is executed by the asynchronous internal clock, the period of idle0/sleep0 mode might be shorter than the period setting by tbtcr. note 6: when idle1/2 or sleep1/2 mode is rel eased, idle is automatically cleared to ?0?. note 7: when idle0 or sleep0 mode is released, tghalt is automatically cleared to ?0?. note 8: before setting tghalt to ?1?, be sure to stop peripheral s. if peripherals are not stopped, the interrupt latch of periph erals may be set after idle0 or sleep0 mode is released. system control register 1 syscr176543210 (0038h) stop relm retm outen wut (initial value: 0000 00**) stop stop mode start 0: cpu core and peripherals remain active 1: cpu core and peripherals are halted (start stop mode) r/w relm release method for stop mode 0: edge-sensitive release 1: level-sensitive release r/w retm operating mode after stop mode 0: return to normal1/2 mode 1: return to slow1 mode r/w outen port output during stop mode 0: high impedance 1: output kept r/w wut warm-up time at releasing stop mode return to normal mode return to slow mode r/w 00 01 10 11 3 x 2 16 /fc 2 16 /fc 3 x 2 14 /fc 2 14 /fc 3 x 2 13 /fs 2 13 /fs 3 x 2 6 /fs 2 6 /fs system control register 2 syscr2 (0039h) 76543210 xen xten sysck idle tghalt (initial value: 1000 *0**) xen high-frequency oscillator control 0: turn off oscillation 1: turn on oscillation r/w xten low-frequency oscillator control 0: turn off oscillation 1: turn on oscillation sysck main system clock select (write)/main system clock moni- tor (read) 0: high-frequency clock (normal1/normal2/idle1/idle2) 1: low-frequency clock (slow1/slow2/sleep1/sleep2) idle cpu and watchdog timer control (idle1/2 and sleep1/2 modes) 0: cpu and watchdog timer remain active 1: cpu and watchdog timer are stopped (start idle1/2 and sleep1/2 modes) r/w tghalt tg control (idle0 and sleep0 modes) 0: feeding clock to all peripherals from tg 1: stop feeding clock to peripherals except tbt from tg. (start idle0 and sleep0 modes)
page 18 2. operational description 2.2 system clock controller TMP86FS28FG 2.2.4 operating mode control 2.2.4.1 stop mode stop mode is controlled by the system control register 1, the stop pin input and key-on wakeup input (stop5 to stop2) which is controlled by the stop mode release control register (stopcr). the stop pin is also used both as a port p20 and an int5 (external interrupt input 5) pin. stop mode is started by setting syscr1 to ?1?. during stop mode, the following status is maintained. 1. oscillations are turned off, and all internal operations are halted. 2. the data memory, registers, the program status wo rd and port output latches are all held in the status in effect before stop mode was entered. 3. the prescaler and the divider of th e timing generator are cleared to ?0?. 4. the program counter holds the address 2 ahead of th e instruction (e.g., [set (syscr1).7]) which started stop mode. stop mode includes a level-sensitive mode and an edge-sensitive mode, either of which can be selected with the syscr1. do not use any key-on wakeup input (stop5 to stop2) for releas- ing stop mode in edge-sensitive mode. note 1: the stop mode can be released by either th e stop or key-on wakeup pin (stop5 to stop2). however, because the stop pin is different from the key-on wakeup and can not inhibit the release input, the stop pin must be used for releasing stop mode. note 2: during stop period (from start of stop mode to end of warm up), due to changes in the external interrupt pin signal, interrupt latches may be set to ?1? and interrupts may be accepted immediately after stop mode is released. before starting stop mode, therefore, disable interrupts. also, before enabling interrupts after stop mode is rel eased, clear unnecessary interrupt latches. (1) level-sensitive release mode (relm = ?1?) in this mode, stop mode is released by setting the stop pin high or setting the stop5 to stop2 pin input which is enabled by stopcr. this mo de is used for capacitor backup when the main power supply is cut off and long term battery backup. even if an instruction for starting stop mode is executed while stop pin input is high or stop5 to stop2 ld (syscr1), 01010000b ; sets up the level-sensitive release mode sstoph: test (p2prd). 0 ; wait until the stop pin input goes low level jrs f, sstoph di ; imf m 0 set (syscr1). 7 ; starts stop mode
page 19 TMP86FS28FG figure 2-7 level-s ensitive release mode note 1: even if the stop pin input is low after warm-up start, the stop mode is not restarted. note 2: in this case of changing to the level-s ensitive mode from the edge-s ensitive mode, the release mode is not switched until a rising edge of the stop pin input is detected. (2) edge-sensitive release mode (relm = ?0?) in this mode, stop mode is released by a rising edge of the stop pin input. this is used in appli- cations where a relatively short pr ogram is executed repeat edly at periodic intervals. this periodic signal (for example, a clock from a low-power consumption oscillator) is input to the stop pin. in the edge-sensitive release mode, stop mode is started even when the stop pin input is high level. do not use any stop5 to stop2 pin input for releasing stop mode in edge-sensitive release mode. figure 2-8 edge-sensitive release mode example 2 :starting stop mode from normal mode with an int5 interrupt. pint5: test (p2prd). 0 ; to reject noise, stop mode does not start if jrs f, sint5 port p20 is at high ld (syscr1), 01010000b ; sets up the level-sensitive release mode. di ; imf m 0 set (syscr1). 7 ; starts stop mode sint5: reti example :starting stop mode from normal mode di ; imf m 0 ld (syscr1), 10010000b ; starts after specified to the edge-sensitive release mode v ih normal operation warm up stop operation confirm by program that the stop pin input is low and start stop mode. always released if the stop pin input is high. stop pin xout pin stop mode is released by the hardware. normal operation normal operation normal operation v ih stop mode is released by the hardware at the rising edge of stop pin input. warm up stop mode started by the program. stop operation stop operation stop pin xout pin
page 20 2. operational description 2.2 system clock controller TMP86FS28FG stop mode is released by the following sequence. 1. in the dual-clock mode, when returning to normal2, both the high-frequency and low- frequency clock oscillators are turned on; when returning to slow1 mode, only the low- frequency clock oscillator is turned on. in the single-clock mode, only the high-frequency clock oscillator is turned on. 2. a warm-up period is inserted to allow oscillation time to stabilize. during warm up, all internal operations remain halted. four differ ent warm-up times can be selected with the syscr1 in accordance with the resonator characteristics. 3. when the warm-up time has elapsed, normal operation resumes with the instruction follow- ing the stop mode start instruction. note 1: when the stop mode is released, the start is made after the prescaler and the divider of the timing generator are cleared to "0". note 2: stop mode can also be released by inputting low level on the reset pin, which immediately performs the normal reset operation. note 3: when stop mode is released with a low hold voltage, the following cautions must be observed. the power supply voltage must be at the operating voltage level before releasing stop mode. the reset pin input must also be ?h? level, rising together with the power supply voltage. in this case, if an external time const ant circuit has been connected, the reset pin input voltage will increase at a slower pace than the power supply vo ltage. at this time, there is a danger that a reset may occur if input voltage level of the reset pin drops below the non-inverting high-level input voltage (hysteresis input). note 1: the warm-up time is obtained by dividing the ba sic clock by the divider. therefore, the warm-up time may include a certain amount of error if ther e is any fluctuation of the oscillation frequency when stop mode is released. thus, the warm -up time must be considered as an approximate value. table 2-2 warm-up time example (at fc = 16.0 mhz, fs = 32.768 khz) wut warm-up time [ms] return to normal mode return to slow mode 00 01 10 11 12.288 4.096 3.072 1.024 750 250 5.85 1.95
page 21 TMP86FS28FG figure 2-9 stop mode start/release instruction address a + 4 0 instruction address a + 3 turn on turn on warm up 0 n halt set (syscr1). 7 turn off (a) stop mode start (example: start with set (syscr1). 7 instruction located at address a) a + 6 a + 5 a + 4 a + 3 a + 2 n + 2 n + 3 n + 4 a + 3 n + 1 instruction address a + 2 2 1 0 3 (b) stop mode release count up turn off halt oscillator circuit program counter instruction execution divider main system clock oscillator circuit stop pin input program counter instruction execution divider main system clock
page 22 2. operational description 2.2 system clock controller TMP86FS28FG 2.2.4.2 idle1/2 mode and sleep1/2 mode idle1/2 and sleep1/2 modes are controlled by the system control register 2 (syscr2) and maskable interrupts. the following status is maintained during these modes. 1. operation of the cpu and watchdog timer (wdt) is halted. on-chip peripherals continue to operate. 2. the data memory, cpu registers, program status word and port output latches are all held in the status in effect before these modes were entered. 3. the program counter holds the address 2 ahead of th e instruction which starts these modes. figure 2-10 idle1/ 2 and sleep1/2 modes reset reset input ?0? ?1? (interrupt release mode) yes no no cpu and wdt are halted interrupt request imf interrupt processing normal release mode yes starting idle1/2 and sleep1/2 modes by instruction execution of the instruc- tion which follows the idle1/2 and sleep1/2 modes start instruction
page 23 TMP86FS28FG ? start the idle1/2 and sleep1/2 modes after imf is set to "0", set the individual inte rrupt enable flag (ef) which releases idle1/2 and sleep1/2 modes. to start idle1/2 and sl eep1/2 modes, set syscr2 to ?1?. ? release the idle1 /2 and sleep1/2 modes idle1/2 and sleep1/2 modes include a normal release mode and an interrupt release mode. these modes are selected by interrupt master en able flag (imf). after releasing idle1/2 and sleep1/2 modes, the syscr2 is automa tically cleared to ?0? and the operation mode is returned to the mode preced ing idle1/2 and sleep1/2 modes. idle1/2 and sleep1/2 modes can also be released by inputting low level on the reset pin. after releasing reset, the operation mode is started from normal1 mode. (1) normal release mode (imf = ?0?) idle1/2 and sleep1/2 modes are released by any interrupt source enabled by the individual interrupt enable flag (ef). after the interrupt is ge nerated, the program operation is resumed from the instruction following the idle1/2 and sleep1/2 mo des start instruction. normally, the interrupt latches (il) of the interrupt source used for releas ing must be cleared to ?0? by load instructions. (2) interrupt release mode (imf = ?1?) idle1/2 and sleep1/2 modes are released by any interrupt source enabled with the individual interrupt enable flag (ef) and the interrupt processi ng is started. after the interrupt is processed, the program operation is resumed from the instruction following the instruction, which starts idle1/2 and sleep1/2 modes. note: when a watchdog timer interrupts is generated immediately before idle1/2 and sleep1/2 modes are started, the watchdog timer interrupt will be processed but idle1/2 and sleep1/2 modes will not be started.
page 24 2. operational description 2.2 system clock controller TMP86FS28FG figure 2-11 idle1/2 and sleep1/2 modes start/release halt halt halt halt operate instruction address a + 2 a + 3 a + 2 a + 4 a + 3 a + 3 halt set (syscr2). 4 operate operate operate acceptance of interrupt ?r:w normal release mode ?s:w interrupt release mode main system clock interrupt request program counter instruction execution watchdog timer main system clock interrupt request program counter instruction execution watchdog timer main system clock interrupt request program counter instruction execution watchdog timer (a) idle1/2 and sleep1/2 modes start (example: star ting with the set instruction located at address a) (b) idle1/2 and sleep1/2 modes release
page 25 TMP86FS28FG 2.2.4.3 idle0 and sleep0 modes (idle0, sleep0) idle0 and sleep0 modes are controlled by the system control register 2 (syscr2) and the time base timer control register (tbtcr). the following stat us is maintained during idle0 and sleep0 modes. 1. timing generator stops feeding clock to peripherals except tbt. 2. the data memory, cpu registers, program status word and port output latches are all held in the status in effect before idle0 and sleep0 modes were entered. 3. the program counter holds the address 2 ahead of the instru ction which starts idle0 and sleep0 modes. note: before starting idle0 or sleep0 mode, be sure to stop (disable) peripherals. figure 2-12 idle 0 and sleep0 modes yes (normal release mode) yes (interrupt release mode) no yes reset input cpu and wdt are halted reset tbt source clock falling edge tbtcr = "1" interrupt processing imf = "1" yes tbt interrupt enable no no no no stopping peripherals by instruction yes starting idle0, sleep0 modes by instruction execution of the instruction which follows the idle0, sleep0 modes start instruction
page 26 2. operational description 2.2 system clock controller TMP86FS28FG ? start the idle0 and sleep0 modes stop (disable) peripherals such as a timer counter. to start idle0 and sleep0 modes, set syscr2 to ?1?. ? release the idle0 and sleep0 modes idle0 and sleep0 modes include a normal re lease mode and an interrupt release mode. these modes are selected by inte rrupt master flag (imf), the i ndividual interrupt enable flag of tbt and tbtcr. after releasing idle0 and sleep0 modes, the syscr2 is automatically cleared to ?0? and the operatio n mode is returned to the mode preceding idle0 and sleep0 modes. before starting the idle0 or sleep0 mode, when the tbtcr is set to ?1?, inttbt interrupt latch is set to ?1?. idle0 and sleep0 modes can also be re leased by inputting low level on the reset pin. after releasing reset, the operation mode is started from normal1 mode. note: idle0 and sleep0 modes start/release wi thout reference to tbtcr setting. (1) normal release mode (imf x ef6 x tbtcr = ?0?) idle0 and sleep0 modes are released by the source clock falling edge, which is setting by the tbtcr. after the falling edge is detect ed, the program operation is resumed from the instruction following the idle0 and sleep0 modes start instruction. before starting the idle0 or sleep0 mode, when the tbtcr is set to ?1?, inttbt interrupt latch is set to ?1?. (2) interrupt release mode (imf x ef6 x tbtcr = ?1?) idle0 and sleep0 modes are released by the source clock falling edge, which is setting by the tbtcr and inttbt interrupt processing is started. note 1: because returning from idle0, sleep0 to normal1, slow1 is executed by the asynchro- nous internal clock, the period of idle0, sleep0 mode might be the shorter than the period set- ting by tbtcr. note 2: when a watchdog timer interrupt is generat ed immediately before idle0/sleep0 mode is started, the watchdog timer interrupt will be processed but idle0/sleep0 mode will not be started.
page 27 TMP86FS28FG figure 2-13 idle0 and slee p0 modes start/release halt halt operate instruction address a + 2 halt operate set (syscr2). 2 halt operate acceptance of interrupt halt ?r:w normal release mode ?s:w interrupt release mode main system clock interrupt request program counter instruction execution watchdog timer main system clock tbt clock tbt clock program counter instruction execution watchdog timer main system clock program counter instruction execution watchdog timer a + 3 a + 2 a + 4 a + 3 a + 3 (a) idle0 and sleep0 modes start (example: starting with the set instruction located at address a (b) idle and sleep0 modes release
page 28 2. operational description 2.2 system clock controller TMP86FS28FG 2.2.4.4 slow mode slow mode is controlled by the sy stem control register 2 (syscr2). the following is the methods to switch the mode with the warm-up counter. (1) switching from normal2 mode to slow1 mode first, set syscr2 to switch the main system clock to the low-frequency clock for slow2 mode. next, clear syscr2 to turn off high-frequency oscillation. note: the high-frequency clock can be co ntinued oscillation in order to return to normal2 mode from slow mode quickly. always turn off oscillat ion of high-frequency clock when switching from slow mode to stop mode. example 1 :switching from normal2 mode to slow1 mode. set (syscr2). 5 ; syscr2 m 1 (switches the main system clock to the low-frequency clock for slow2) clr (syscr2). 7 ; syscr2 m 0 (turns off high-frequency oscillation) example 2 :switching to the slow1 mode after low-frequency clock has stabilized. set (syscr2). 6 ; syscr2 m 1 ld (tc3cr), 43h ; sets mode for tc4, 3 (16-bit mode, fs for source) ld (tc4cr), 05h ; sets warming-up counter mode ldw (ttreg3), 8000h ; sets warm-up time (depend on oscillator accompanied) di ; imf m 0 set (eire). 5 ; enables inttc4 ei ; imf m 1 set (tc4cr). 3 ; starts tc4, 3 : pinttc4: clr (tc4cr). 3 ; stops tc4, 3 set (syscr2). 5 ; syscr2 m 1 (switches the main system cl ock to the low-frequency clock) clr (syscr2). 7 ; syscr2 m 0 (turns off high-frequency oscillation) reti : vinttc4: dw pinttc4 ; inttc4 vector table
page 29 TMP86FS28FG (2) switching from slow1 mode to normal2 mode note: after sysck is cleared to ?0?, executing the in structions is continiued by the low-frequency clock for the period synchronized with low-frequency and high-frequency clocks. first, set syscr2 to turn on the high-fre quency oscillation. when time for stabilization (warm up) has been taken by the timer/counter (tc4,tc3), clear syscr2 to switch the main system clock to the high-frequency clock. slow mode can also be released by inputting low level on the reset pin. after releasing reset, the operation mode is started from normal1 mode. example :switching from the slow1 mode to the normal2 mode (fc = 16 mhz, warm-up time is 4.0 ms). set (syscr2). 7 ; syscr2 m 1 (starts high-frequency oscillation) ld (tc3cr), 63h ; sets mode for tc4, 3 (16-bit mode, fc for source) ld (tc4cr), 05h ; sets warming-up counter mode ld (ttreg4), 0f8h ; sets warm-up time di ; imf m 0 set (eire). 5 ; enables inttc4 ei ; imf m 1 set (tc4cr). 3 ; starts tc4, 3 : pinttc4: clr (tc4cr). 3 ; stops tc4, 3 clr (syscr2). 5 ; syscr2 m 0 (switches the main system clock to the high-frequency clock) reti : vinttc4: dw pinttc4 ; inttc4 vector table high-frequency clock low-frequency clock main system clock sysck
page 30 2. operational description 2.2 system clock controller TMP86FS28FG figure 2-14 switching between the normal2 and slow modes set (syscr2). 7 normal2 mode clr (syscr2). 7 set (syscr2). 5 normal2 mode turn off (a) switching to the slow mode slow1 mode slow2 mode clr (syscr2). 5 (b) switching to the normal2 mode high- frequency clock low- frequency clock main system clock instruction execution sysck xen high- frequency clock low- frequency clock main system clock instruction execution sysck xen slow1 mode warm up during slow2 mode
page 31 TMP86FS28FG 2.3 reset circuit the TMP86FS28FG has four types of reset generation procedur es: an external reset input, an address trap reset, a watchdog timer reset and a system clock re set. of these reset, the address trap reset, the watchdog timer and the sys- tem clock reset are a malfunction reset. when the malfunction reset request is detected, reset occurs during the max- imum 24/fc[s]. the malfunction reset circuit such as watchdog timer reset, address trap reset and system clock reset is not initial- ized when power is turned on. therefore, reset may occur during maximum 24/fc[s] (1.5 p s at 16.0 mhz) when power is turned on. table 2-3 shows on-chip hardware initialization by reset action. 2.3.1 external reset input the reset pin contains a schmitt trigger (hysteresis) with an internal pull-up resistor. when the reset pin is held at ?l? level for at least 3 machin e cycles (12/fc [s]) wi th the power supply volt- age within the operating voltage range and oscillation stab le, a reset is applied and the internal state is initial- ized. when the reset pin input goes high, the reset operation is rele ased and the program execution starts at the vector address stored at addresses fffeh to ffffh. figure 2-15 reset circuit table 2-3 initializing internal status by reset action on-chip hardware initial value on-chip hardware initial value program counter (pc) (fffeh) prescaler and divider of timing generator 0 stack pointer (sp) not initialized general-purpose registers (w, a, b, c, d, e, h, l, ix, iy) not initialized jump status flag (jf) not initialized watchdog timer enable zero flag (zf) not initialized output latches of i/o ports refer to i/o port circuitry carry flag (cf) not initialized half carry flag (hf) not initialized sign flag (sf) not initialized overflow flag (vf) not initialized interrupt master enable flag (imf) 0 interrupt individual enable flags (ef) 0 control registers refer to each of control register interrupt latches (il) 0 lcd data buffer not initialized ram not initialized internal reset reset vdd malfunction reset output circuit watchdog timer reset address trap reset system clock reset
page 32 2. operational description 2.3 reset circuit TMP86FS28FG 2.3.2 address trap reset if the cpu should start looping for some cause such as noise and an attempt be made to fetch an instruction from the on-chip ram (when wdtcr1 is set to ?1 ?), dbr or the sfr area, ad dress trap reset will be generated. the reset time is maximum 24/fc[s] (1.5 p s at 16.0 mhz). note:the operating mode under address tr apped is alternative of reset or interrupt. the address trap area is alter- native. note 1: address ?a? is in the sfr, dbr or on-chip ram (wdtcr1 = ?1?) space. note 2: during reset release, reset vector ?r? is read out, and an instruction at address ?r? is fetched and decoded. figure 2-16 addr ess trap reset 2.3.3 watchdog timer reset refer to section ?watchdog timer?. 2.3.4 system clock reset if the condition as follows is detected, the system clock reset occurs automatically to prevent dead lock of the cpu. (the oscillation is continued without stopping.) - in case of clearing syscr2 an d syscr2 simultaneously to ? 0 ? . - in case of clearing syscr2 to ? 0 ? , when the syscr2 is ? 0 ? . - in case of clearing syscr2 to ? 0 ? , when the syscr2 is ? 1 ? . the reset time is maximum 24/fc (1.5 p s at 16.0 mhz). instruction at address r 16/fc [s] maximum 24/fc [s] instruction execution internal reset jp a reset release address trap is occurred 4/fc to 12/fc [s]
page 33 TMP86FS28FG
page 34 2. operational description 2.3 reset circuit TMP86FS28FG
page 35 TMP86FS28FG 3. interrupt control circuit the TMP86FS28FG has a total of 23 inte rrupt sources excluding reset. interrup ts can be nested with priorities. four of the internal interrupt sources ar e non-maskable while the rest are maskable. interrupt sources are provided with interrupt latches (il) , which hold interrupt requests, and independent vectors. the interrupt latch is set to ?1? by th e generation of its interrupt request wh ich requests the cpu to accept its inter- rupts. interrupts are enabled or disabled by software using the interrupt master enable fl ag (imf) and in terrupt enable flag (ef). if more than one interrupts are generated simultaneously, interrup ts are accepted in order which is domi- nated by hardware. however, there are no prioritized interrupt factors among non-maskable interrupts. note 1: to use the address trap interrupt (intatrap), clear wdtcr1 to ?0? (it is set for the ?reset request? after reset is cancelled). for details , see ?address trap?. note 2: to use the watchdog timer interrupt (intwdt), clear wdtcr1 to "0" (it is set for the "reset request" after reset is released). for details, see "watchdog timer". interrupt factors enable condition interrupt latch vector address priority internal/external (reset) non-maskable ? fffe 1 internal intswi (software interrupt) non-maskable ? fffc 2 internal intundef (executed the undefined instruction interrupt) non-maskable ? fffc 2 internal intatrap (address trap interrupt) non-maskable il2 fffa 2 internal intwdt (watchdog timer interrupt) non-maskable il3 fff8 2 external int0 imf? ef4 = 1, int0en = 1 il4 fff6 5 external int1 imf? ef5 = 1 il5 fff4 6 internal inttbt imf? ef6 = 1 il6 fff2 7 internal inttc10 imf? ef7 = 1 il7 fff0 8 internal intrxd0 imf? ef8 = 1 il8 ffee 9 internal inttxd0 imf? ef9 = 1 il9 ffec 10 internal inttc11 imf? ef10 = 1 il10 ffea 11 external int2 imf? ef11 = 1 il11 ffe8 12 - reserved imf? ef12 = 1 il12 ffe6 13 - intsio imf? ef13 = 1 il13 ffe4 14 - reserved imf? ef14 = 1 il14 ffe2 15 - reserved imf? ef15 = 1 il15 ffe0 16 - reserved imf? ef16 = 1 il16 ffbe 17 - reserved imf? ef17 = 1 il17 ffbc 18 - reserved imf? ef18 = 1 il18 ffba 19 - reserved imf? ef19 = 1 il19 ffb8 20 internal inttc3 imf? ef20 = 1 il20 ffb6 21 internal inttc4 imf? ef21 = 1 il21 ffb4 22 external int3 imf? ef22 = 1 il22 ffb2 23 internal inttc5 imf? ef23 = 1 il23 ffb0 24 internal inttc6 imf? ef24 = 1 il24 ffae 25 external int4 imf? ef25 = 1 il25 ffac 26 external int5 imf? ef26 = 1 il26 ffaa 27 internal intrxd1 imf? ef27 = 1 il27 ffa8 28 internal inttxd1 imf? ef28 = 1 il28 ffa6 29 internal intadc imf? ef29 = 1 il29 ffa4 30 - reserved imf? ef30 = 1 il30 ffa2 31 - reserved imf? ef31 = 1 il31 ffa0 32
page 36 3. interrupt control circuit 3.1 interrupt latches (il29 to il2) TMP86FS28FG 3.1 interrupt latches (il29 to il2) an interrupt latch is provided for eac h interrupt source, except for a software interrupt and an executed the unde- fined instruction interrupt. when interrupt request is genera ted, the latch is set to ?1?, and the cpu is requested to accept the interrupt if its interrupt is enabled. the interrupt latch is cleared to "0" immediately after accepting inter- rupt. all interrupt latches are initialized to ?0? during reset. the interrupt latches are located on address 002eh, 002fh, 003ch and 003dh in sfr area. each latch can be cleared to "0" individually by instruction. however, il2 and il3 should not be cleared to "0" by software. for clear- ing the interrupt latch, load instruction should be used and then il2 and il3 should be set to "1". if the read-modify- write instructions such as bit manipulation or operation instructions are used, interrupt request would be cleared inadequately if interrupt is requeste d while such instructions are executed. interrupt latches are not set to ?1? by an instruction. since interrupt latches can be read, the status fo r interrupt requests can be monitored by software. note: in main program, before manipulating the interrupt enable flag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf new ly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf becomes "0 " automatically, clearing imf need not execute normally on interrupt service routine. however, if using multiple inte rrupt on interrupt service routine, manipulating ef or il should be executed before setting imf="1". 3.2 interrupt enab le register (eir) the interrupt enable register (eir) enables and disables the acceptance of interrupts, except fo r the non-maskable interrupts (software interrupt, undefined instruction interr upt, address trap interrupt and watchdog interrupt). non- maskable interrupt is accepted regardless of the contents of the eir. the eir consists of an interrupt mast er enable flag (imf) and the individua l interrupt enable flags (ef). these registers are located on address 002ch, 002dh, 003ah and 003bh in sfr area, and they can be read and written by an instructions (including read-modify-write instruc tions such as bit manipulation or operation instructions). 3.2.1 interrupt ma ster enable flag (imf) the interrupt enable register (imf ) enables and disables the acceptance of the whole maskable interrupt. while imf = ?0?, all maskable interrupts are not accepted regardless of the status on each individual interrupt enable flag (ef). by setting imf to ?1?, the interrupt becomes acceptable if the individuals are enabled. when an interrupt is accepted, imf is cleared to ?0? after the latest status on imf is stacked. thus the maskable inter- rupts which follow are disabled. by executing return interrupt instruction [reti/retn], the stacked data, which was the status before interrup t acceptance, is loaded on imf again. the imf is located on bit0 in eirl (address: 003ah in sfr), and can be read and written by an instruction. the imf is normally set and cl eared by [ei] and [di] instruction respectively. during reset, the imf is initial- ized to ?0?. example 1 :clears interrupt latches di ; imf m 0 ldw (ill), 111010000011 1111b ; il12, il10 to il6 m 0 ei ; imf m 1 example 2 :reads interrupt latchess ld wa, (ill) ; w m ilh, a m ill example 3 :tests interrupt latches test (ill). 7 ; if il7 = 1 then jump jr f, sset
page 37 TMP86FS28FG 3.2.2 individual interrupt enable flags (ef29 to ef4) each of these flags enables and disables the acceptan ce of its maskable interrupt . setting the corresponding bit of an individual interrupt enable flag to ?1? enables acceptan ce of its interrupt, and setting the bit to ?0? dis- ables acceptance. during reset, all the i ndividual interrupt enable flags (ef29 to ef4) ar e initialized to ?0? and all maskable interrupts are not accepted until they are set to ?1?. note:in main program, before manipulating the interrupt enable flag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf newly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf become s "0" automatically, clearing imf need not execute nor- mally on interrupt service routine. however, if using mult iple interrupt on interrupt service routine, manipulat- ing ef or il should be executed before setting imf="1". example 1 :enables interrupts individually and sets imf di ; imf m 0 ldw : (eirl), 1110100010100000b ; ef15 to ef13, ef11, ef7, ef5 m 1 note: imf should not be set. : ei ; imf m 1 example 2 :c compiler description example unsigned int _io (3ah) eirl; /* 3ah shows eirl address */ _di(); eirl = 10100000b; : _ei();
page 38 3. interrupt control circuit 3.2 interrupt enable register (eir) TMP86FS28FG note 1: to clear any one of bits il7 to il4, be sure to write "1" into il2 and il3. note 2: in main program, before manipulating the interrupt enable fl ag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf newly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf becomes "0" automatically, clear ing imf need not execute normally on inter- rupt service routine. however, if using multiple interrupt on interrupt service routine, mani pulating ef or il should be exe- cuted before setting imf="1". note 3: do not clear il with read-modify-w rite instructions such as bit operations. note 1: *: don?t care note 2: do not set imf and the interrupt enable flag (ef15 to ef4) to ?1? at the same time. note 3: in main program, before manipulating the interrupt enable fl ag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf newly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf becomes "0" automatically, clear ing imf need not execute normally on inter- rupt service routine. however, if using multiple interrupt on interrupt service routine, mani pulating ef or il should be exe- cuted before setting imf="1". interrupt latches (initial value: 00000000 000000**) ilh,ill (003dh, 003ch) 1514131211109876543210 il15 il14 il13 il12 il11 il10 il9 il8 il7 il6 il5 il4 il3 il2 ilh (003dh) ill (003ch) (initial value: 00000000 00000000) ild,ile (002fh, 002eh) 1514131211109876543210 il31 il30 il29 il28 il27 il26 il25 il24 il23 il22 il21 il20 il19 il18 il17 il16 ild (002fh) ile (002eh) il29 to il2 interrupt latches at rd 0: no interrupt request 1: interrupt request at wr 0: clears the interrupt request 1: (interrupt latch is not set.) r/w interrupt enable registers (initial value: 00000000 0000***0) eirh,eirl (003bh, 003ah) 1514131211109876543210 ef15 ef14 ef13 ef12 ef11 ef10 ef9 ef8 ef7 ef6 ef5 ef4 imf eirh (003bh) eirl (003ah) (initial value: 00000000 00000000) eird,eire (002dh, 002ch) 1514131211109876543210 ef31 ef30 ef29 ef28 ef27 ef26 ef25 ef24 ef23 ef22 ef21 ef20 ef19 ef18 ef17 ef16 eird (002dh) eire (002ch) ef29 to ef4 individual-interrupt enable flag (specified for each bit) 0: 1: disables the acceptance of each maskable interrupt. enables the acceptance of each maskable interrupt. r/w imf interrupt master enable flag 0: 1: disables the acceptance of all maskable interrupts enables the acceptance of all maskable interrupts
page 39 TMP86FS28FG 3.3 interrupt sequence an interrupt request, which raised inte rrupt latch, is held, until interrupt is accepted or interrupt latch is cleared to ?0? by resetting or an instruct ion. interrupt acceptance sequence requires 8 machine cycles (2 p s @16 mhz) after the completion of the current instruction. the interrupt service task terminates upon execution of an interrupt return instruction [reti] (for maskable interrupts) or [retn] (for non-maskable interrupts). figure 3-1 shows the timing chart of interrupt acceptance processing. 3.3.1 interrupt acceptance proc essing is packaged as follows. a. the interrupt master enab le flag (imf) is cleared to ?0? in or der to disable the acceptance of any fol- lowing interrupt. b. the interrupt latch (il) for the interrupt source accepted is cleared to ?0?. c. the contents of the program coun ter (pc) and the program status word, including the interrupt master enable flag (imf), are saved (pushed) on the st ack in sequence of psw + imf, pch, pcl. mean- while, the stack pointer (s p) is decremented by 3. d. the entry address (interrupt vect or) of the corresponding interrupt service program, loaded on the vec- tor table, is transferred to the program counter. e. the instruction stored at the entry address of the inte rrupt service program is executed. note:when the contents of psw are saved on the stack, the contents of imf are also saved. note 1: a: return address entry address, b: entry address, c: address which reti instruction is stored note 2: on condition that interrupt is enabled, it takes 38/fc [s ] or 38/fs [s] at maximum (if the interrupt latch is set at the first machine cycle on 10 cycle instruction) to start interrupt acceptance processing since its interrupt latch is set. figure 3-1 timing chart of interrupt acceptance/return in terrupt instruction example: correspondence be tween vector table address for inttbt an d the entry address of the interrupt service program figure 3-2 vector table address,entry address a b a c + 1 execute instruction sp pc execute instruction n n ? 2 n - 3 n ? 2n ? 1 n ? 1 n a + 2 a + 1 c + 2 b + 3 b + 2 b + 1 a + 1 a a ? 1 execute reti instruction interrupt acceptance execute instruction interrupt service task 1-machine cycle interrupt request interrupt latch (il) imf d2h 03h d203h d204h 06h vector table address entry address 0fh vector interrupt service program fff2h fff3h
page 40 3. interrupt control circuit 3.3 interrupt sequence TMP86FS28FG a maskable interrupt is not accepted until the imf is set to ?1? even if th e maskable interrupt higher than the level of current servicing interrupt is requested. in order to utilize nested interrupt service, the imf is set to ?1? in the interrupt service program. in this case, acceptable interrupt sources are selectively en abled by the individual interrupt enable flags. to avoid overloaded nesting, clear the individual interrupt enable flag whose interrupt is currently serviced, before setting imf to ?1?. as for non-maskable interr upt, keep interrupt service shorten compared with length between interrupt requests; otherwise the status cannot be recovered as non-maskable interrupt would simply nested. 3.3.2 saving/restoring general-purpose registers during interrupt acceptance processing , the program counter (pc) and the program status word (psw, includes imf) are automati cally saved on the stack, but the accumulato r and others are not. these registers are saved by software if necessary. when multiple interrupt se rvices are nested, it is also necessary to avoid using the same data memory area for saving registers. the fo llowing methods are used to save/restore the general- purpose registers. 3.3.2.1 using push and pop instructions if only a specific register is saved or interrupts of the same source are nested , general-purpose registers can be saved/restored using the push/pop instructions. figure 3-3 save/store register using push and pop instructions 3.3.2.2 using data transfer instructions to save only a specific register wi thout nested interrupts, data tran sfer instructions are available. example :save/store register us ing push and pop instructions pintxx: push wa ; save wa register (interrupt processing) pop wa ; restore wa register reti ; return pcl pch psw at acceptance of an interrupt at execution of push instruction at execution of reti instruction at execution of pop instruction b-4 b-3 b-2 b-1 b pcl pch psw pcl pch psw sp address (example) sp sp sp a w b-5
page 41 TMP86FS28FG figure 3-4 saving/restoring general-purpose r egisters under interrupt processing 3.3.3 interrupt return interrupt return instructions [reti]/[retn] perform as follows. as for address trap interrupt (intatrap), it is requir ed to alter stacked data for program counter (pc) to restarting address, during interrupt service program. note:if [retn] is executed with the above data unaltered, the program returns to the address trap area and intatrap occurs again.when interrupt acceptance pr ocessing has completed, stacked data for pcl and pch are located on address (sp + 1) and (sp + 2) respectively. example :save/store register us ing data transfer instructions pintxx: ld (gsava), a ; save a register (interrupt processing) ld a, (gsava) ; restore a register reti ; return [reti]/[retn] interrupt return 1. program counter (pc) and program status word (psw, includes imf) are restored from the stack. 2. stack pointer (sp) is incremented by 3. example 1 :returning from address trap interrupt (intatrap) service program pintxx: pop wa ; recover sp by 2 ld wa, return address ; push wa ; alter stacked data (interrupt processing) retn ; return interrupt acceptance interrupt service task restoring registers saving registers interrupt return saving/restoring general-purpose registers using push/pop data transfer instruction main task
page 42 3. interrupt control circuit 3.4 software interrupt (intsw) TMP86FS28FG interrupt requests are sampled during the final cycle of the instruction being executed. thus, the next inter- rupt can be accepted immediat ely after the interrupt retu rn instruction is executed. note 1: it is recommended that stack pointer be return to rate before intatrap (increment 3 times), if return inter- rupt instruction [retn] is not utilized during inte rrupt service program under intatrap (such as example 2). note 2: when the interrupt processing time is longer than the interrupt request generation time, the interrupt service task is performed but not the main task. 3.4 software interrupt (intsw) executing the swi instruction generates a software interr upt and immediately starts interrupt processing (intsw is highest prioritized interrupt). use the swi instruction only for detection of the address error or for debugging. 3.4.1 address error detection ffh is read if for some cause such as noise the cpu attempts to fetch an instruction from a non-existent memory address during single chip mode. code ffh is th e swi instruction, so a software interrupt is gener- ated and an address error is detect ed. the address error detection range can be further expanded by writing ffh to unused areas of the program memory. address trap reset is generated in case that an instruction is fetched from ram, dbr or sfr areas. 3.4.2 debugging debugging efficiency can be increased by placing the swi instruction at the software break point setting address. 3.5 undefined instruct ion interrupt (intundef) taking code which is not defined as authorized instru ction for instruction causes intundef. intundef is gen- erated when the cpu fetches such a co de and tries to execute it. intundef is accepted even if non-maskable inter- rupt is in process. contemporary process is broken and intundef interrupt process starts, soon after it is requested. note: the undefined instruction interrupt (intundef) forces cpu to jump into vector address, as software interrupt (swi) does. 3.6 address trap interrupt (intatrap) fetching instruction from unauthorized area for instructio ns (address trapped area) cause s reset output or address trap interrupt (intatrap). intatrap is accepted even if non-maskable interrupt is in process. contemporary pro- cess is broken and intatrap interrupt pro cess starts, soon afte r it is requested. note: the operating mode under address trapped, whether to be reset output or interrupt processing, is selected on watchdog timer control register (wdtcr). example 2 :restarting without returning interrupt (in this case, psw (includes imf) befo re interrupt acceptance is discarded.) pintxx: inc sp ; recover sp by 3 inc sp ; inc sp ; (interrupt processing) ld eirl, data ; set imf to ?1? or clear it to ?0? jp restart address ; jump into restarting address
page 43 TMP86FS28FG 3.7 external interrupts the TMP86FS28FG has 6 external interrupt inputs. these inputs are equipped with digital noise reject circuits (pulse inputs of less than a certa in time are elimin ated as noise). edge selection is also possible with int1 to int4. the int0 /p30 pin can be configured as either an external inter- rupt input pin or an input/output port, and is configured as an input port during reset. edge selection, noise reject control and int0 /p30 pin function selection are performed by the external interrupt control register (eintcr). note 1: in normal1/2 or idle1/2 mode, if a signal with no noise is input on an external interrupt pin, it takes a maximum of "si g- nal establishment time + 6/fs[s]" from the input signal's edge to set the interrupt latch. note 2: when int0en = "0", il4 is not set even if a falling edge is detected on the int0 pin input. note 3: when a pin with more than one function is used as an out put and a change occurs in data or input/output status, an inter - rupt request signal is generated in a pseudo manner. in this ca se, it is necessary to perform appropriate processing such as disabling the interrupt enable flag. source pin enable conditions release edge (level) digital noise reject int0 int0 imf ? ef4 ? int0en=1 falling edge pulses of less than 2/fc [s] are eliminated as noise. pulses of 7/fc [s ] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals. int1 int1 imf ? ef5 = 1 falling edge or rising edge pulses of less than 15/fc or 63/fc [s] are elimi- nated as noise. pulses of 49/fc or 193/fc [s] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are considered to be signals. int2 int2 imf ? ef11 = 1 falling edge or rising edge pulses of less than 7/fc [s] are eliminated as noise. pulses of 25/fc [s] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals. int3 int3 imf ? ef22 = 1 falling edge or rising edge pulses of less than 7/fc [s] are eliminated as noise. pulses of 25/fc [s] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals. int4 int4 imf ? ef25 = 1 falling edge, rising edge, falling and rising edge or h level pulses of less than 7/fc [s] are eliminated as noise. pulses of 25/fc [s] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals. int5 int5 imf ? ef26 = 1 falling edge pulses of less than 2/fc [s] are eliminated as noise. pulses of 7/fc [s ] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals.
page 44 3. interrupt control circuit 3.7 external interrupts TMP86FS28FG note 1: fc: high-frequency clock [hz], *: don?t care note 2: when the system clock frequency is switched between high and low or when the external interrupt control register (eintcr) is overwritten, the noise canceller may not operat e normally. it is recommended that external interrupts are dis- abled using the interrupt enable register (eir). note 3: the maximum time from modifying int1 nc until a noise reject time is changed is 2 6 /fc. note 4: in case reset pin is released while the state of int4 pin keeps "h" level, the external interrupt 4 request is not generated even if the int4 edge select is specified as "h" level. the rising edge is needed after reset pin is released. external interrupt control register eintcr76543210 (0037h) int1nc int0en int4es int3es int2es int1es (initial value: 0000 000*) int1nc noise reject time select 0: pulses of less than 63/fc [s] are eliminated as noise 1: pulses of less than 15/fc [s] are eliminated as noise r/w int0en p30/ int0 pin configuration 0: p30 input/output port 1: int0 pin (port p30 should be set to an input mode) r/w int4 es int4 edge select 00: rising edge 01: falling edge 10: rising edge and falling edge 11: h level r/w int3 es int3 edge select 0: rising edge 1: falling edge r/w int2 es int2 edge select 0: rising edge 1: falling edge r/w int1 es int1 edge select 0: rising edge 1: falling edge r/w
page 45 TMP86FS28FG 4. special function register (sfr) the TMP86FS28FG adopts the memory ma pped i/o system, and all peripheral control and data transfers are per- formed through the special function register (sfr) or the data buffer register (dbr). the sfr is mapped on address 0000h to 003fh, dbr is mapped on address 0f00h to 0fffh. this chapter shows the arrangement of the special functi on register (sfr) and data buffer register (dbr) for TMP86FS28FG. 4.1 sfr address read write 0000h p0dr 0001h p1dr 0002h p2dr 0003h p3dr 0004h p4dr 0005h p5dr 0006h p6dr 0007h p7dr 0008h p8dr 0009h tc3cr 000ah tc4cr 000bh tc5cr 000ch tc6cr 000dh reserved 000eh reserved 000fh reserved 0010h tc10dral 0011h tc10drah 0012h tc10drbl 0013h tc10drbh 0014h tc10cr 0015h ttreg3 0016h ttreg4 0017h ttreg5 0018h ttreg6 0019h pwreg3 001ah pwreg4 001bh pwreg5 001ch pwreg6 001dh reserved 001eh reserved 001fh reserved 0020h tc11dral 0021h tc11drah 0022h tc11drbl 0023h tc11drbh 0024h tc11cr 0025h reserved
page 46 4. special function register (sfr) 4.1 sfr TMP86FS28FG note 1: do not access reserved areas by the program. note 2:  ; cannot be accessed. note 3: write-only registers and interrupt latches cannot use the read-modify-write instructions (bit manipulation instructions such as set, clr, etc. and logical operation instructions such as and, or, etc.). 0026h reserved 0027h reserved 0028h reserved 0029h reserved 002ah reserved 002bh p3outcr 002ch eire 002dh eird 002eh ile 002fh ild 0030h reserved 0031h - stopcr 0032h p0outcr 0033h reserved 0034h - wdtcr1 0035h - wdtcr2 0036h tbtcr 0037h eintcr 0038h syscr1 0039h syscr2 003ah eirl 003bh eirh 003ch ill 003dh ilh 003eh reserved 003fh psw address read write
page 47 TMP86FS28FG 4.2 dbr address read write 0f00h reserved : : : : 0f5fh reserved address read write 0f60h siobr0 0f61h siobr1 0f62h siobr2 0f63h siobr3 0f64h siobr4 0f65h siobr5 0f66h siobr6 0f67h siobr7 0f68h - siocr1 0f69h siosr siocr2 address read write 0f70h reserved : : : : 0f7fh reserved
page 48 4. special function register (sfr) 4.2 dbr TMP86FS28FG address read write 0f80h reserved : : : : 0f9fh reserved address read write 0fa0h reserved 0fa1h reserved 0fa2h reserved 0fa3h reserved 0fa4h reserved 0fa5h reserved 0fa6h reserved 0fa7h reserved 0fa8h reserved 0fa9h reserved 0faah reserved 0fabh reserved 0fach reserved 0fadh reserved flsstb 0faeh reserved 0fafh flscr 0fb0h reserved 0fb1h reserved 0fb2h reserved 0fb3h reserved 0fb4h reserved 0fb5h reserved 0fb6h reserved 0fb7h reserved 0fb8h reserved 0fb9h reserved 0fbah reserved 0fbbh reserved 0fbch reserved 0fbdh reserved 0fbeh reserved 0fbfh reserved
page 49 TMP86FS28FG address read write 0fc0h seg1/0 0fc1h seg3/2 0fc2h seg5/4 0fc3h seg7/6 0fc4h seg9/8 0fc5h seg11/10 0fc6h seg13/12 0fc7h seg15/14 0fc8h seg17/16 0fc9h seg19/18 0fcah seg21/20 0fcbh seg23/22 0fcch seg25/24 0fcdh seg27/26 0fceh seg29/28 0fcfh seg31/30 0fd0h seg33/32 0fd1h seg35/34 0fd2h seg37/36 0fd3h seg39/38 0fd4h p4lcr 0fd5h p5lcr 0fd6h p6lcr 0fd7h p7lcr 0fd8h p8lcr 0fd9h lcdcr 0fdah reserved 0fdbh reserved 0fdch reserved 0fddh reserved 0fdeh reserved 0fdfh reserved
page 50 4. special function register (sfr) 4.2 dbr TMP86FS28FG note 1: do not access reserved areas by the program. note 2:  ; cannot be accessed. note 3: write-only registers and interrupt latches cannot use the read-modify-write instructions (bit manipulation instructions such as set, clr, etc. and logical operation instructions such as and, or, etc.). address read write 0fe0h adcdr2 - 0fe1h adcdr1 - 0fe2h adccr1 0fe3h adccr2 0fe4h reserved 0fe5h uart0sr uart0cr1 0fe6h - uart0cr2 0fe7h rd0buf td0buf 0fe8h uart1sr uart1cr1 0fe9h - uart1cr2 0feah rd1buf td1buf 0febh reserved 0fech reserved 0fedh reserved 0feeh reserved 0fefh reserved 0ff0h p0prd - 0ff1h reserved 0ff2h p2prd - 0ff3h p3prd - 0ff4h p4prd - 0ff5h p5prd - 0ff6h p6prd - 0ff7h p7prd - 0ff8h p8prd - 0ff9h p1cr1 0ffah p1cr2 0ffbh p4outcr 0ffch p5outcr 0ffdh p6outcr 0ffeh p7outcr 0fffh p8outcr
page 51 TMP86FS28FG 5. i/o ports the TMP86FS28FG has 9 input/output ports (62 pins) as shown below. table 5-1 port functions primary function secondary functions port p0 3-bit input/output port external interrupt input, ppg output port p1 8-bit input/output port analog input, stop mode release signal input port p2 3-bit input/output port external interrupt input, low-freque ncy resonator connection, stop mode release signal input port p3 8-bit input/output port external interrupt input, timer/counter input, serial interface input/output, uart input/output, divider output port p4 8-bit input/output port external interrupt input, timer/counter input, lcd segment output, ppg output port p5 8-bit input/output port timer/counter input/output, lcd segment output, uart input/output port p6 8-bit input/output port lcd segment output port p7 8-bit input/output port lcd segment output port p8 8-bit input/output port lcd segment output table 5-2 register list port latch read pch control cr1 cr2 lcd control p0 p0dr (0000h) p0prd (0ff0h) p0outcr (0032h)  p1 p1dr (0001h)  p1cr1 (0ff9h) p1cr2 (0ffah)  p2 p2dr (0002h) p2prd (0ff2h)  p3 p3dr (0003h) p3prd (0ff3h) p3outcr (002bh)  p4 p4dr (0004h) p4prd (0ff4h) p4outcr (0ffbh)  p4lcr (0fd4h) p5 p5dr (0005h) p5prd (0ff5h) p5outcr (0ffch)  p5lcr (0fd5h) p6 p6dr (0006h) p6prd (0ff6h) p6outcr (0ffdh)  p6lcr (0fd6h) p7 p7dr (0007h) p7prd (0ff7h) p7outcr (0ffeh)  p7lcr (0fd7h) p8 p8dr (0008h) p8prd (0ff8h) p8outcr (0fffh)  p8lcr (0fd8h)
page 52 5. i/o ports TMP86FS28FG each output port contains a latch for holding output data. all input ports do not have latches, making it necessary to externally hold input data until it is read externally or to read input data multiple times before it is processed. fig- ure 5-1 shows input/output timings. external data is read from an input/output port in the s1 state of the read cycle in in struction execution. since this timing cannot be recognized externally, transient input such as chattering must be processed by software. data is out- put to an input/output port in the s2 state of the write cycle in instruction execution. note: the positions of the read and write c ycles may vary depending on the instruction. figure 5-1 input/output timings (example) instruction execution cycle input strobe data input ex: ld a, (x) fetch cycle fetch cycle read cycle s0 s1 s2 s3 s0 s1 s2 s3 s0 s1 s2 s3 instruction execution cycle output latch pulse data output ex: ld (x), a fetch cycle fetch cycle write cycle s0 s1 s2 s3 s0 s1 s2 s3 s0 s1 s2 s3 (a) input timing (b) output timing
page 53 TMP86FS28FG 5.1 port p0 (p00 to p02) port p0 is a 3-bit input/output port that can also be used for external interrupt input or ppg output. a reset initializes the output latch (p0dr) to ?1? and the pch control (p0outcr) to ?0?. to use a pin in port p0 as an input po rt or external interrupt input, set p0dr to ?1? and then set the corresponding bit in p0outcr to ?0?. to use a pin in port p0 as a ppg output, set p0dr to ?1?. the output circuit of port p0 can be se t either as sink open-drain output (?0?) or cmos output (?1?) individually for each bit in p0outcr. port p0 has a separate data input register. the output latch state can be read from the p0dr register, and the pin state can be read from the p0prd register. figure 5-2 port p0 table 5-3 register programming for port p0 (p00 to p02) function programmed value p0dr p0outcr port input, external interrupt input ?1? ?0? port "0" output ?0? set as appropriate. port "1" output, ppg output ?1? data input (p0prd) output latch read (p0dr) stop outen p0outcri input data output (p0dr) p0outcri p0i note) i = 2~0 dq dq control output control input output latch
page 54 5. i/o ports 5.1 port p0 (p00 to p02) TMP86FS28FG p0dr (0000h) r/w 76543210 p02 ppg1 int3 p01 p00 (initial value: **** *111) p0outcr (0032h) r/w 76543210 (initial value: **** *000) p0outcr port p0 input/output control (set for each bit individually) 0: sink open-drain output 1: cmos output r/w p0prd (0ff0h) 76543210 p02 p01 p00 (initial value: **** *000) read only
page 55 TMP86FS28FG 5.2 port p1 (p10 to p17) port p1 is an 8-bit input/output port that can be configured as an input or an output on a bit basis. port p1 is also used for analog input or key-on wake-up input. the port p1 input/output control register (p1cr1) and port p1 input control register (p1cr2) are used to specify the function of each pin. a reset initializes p1cr1 to ?0?, p1cr2 to ?1?, and the output latch (p1dr) to ?0? so that port p1 becomes an input port. to use a pin in port p1 as an input por t, set p1cr1 to ?0? and then set p1cr2 to ?1?. to use a pin in port p1 as an analog input or key-on wake-up input, set p1cr1 to ?0? and then set p1cr2 to ?0?. to use a pin in port p1 as an output port, set the corresponding bit in p1cr1 to ?1?. to read the output latch data, set p1cr1 to ?1?and read p1dr. to read the pin state, set p1cr1 to ?0? and p1cr2 to ?1? and then read p1dr. when p1cr1 = ?0 ? and p1cr2 = ?0?, p1dr is read as ?0?. bits not used as analog inputs are used as input/output pins. during ad conversion, however, output instructions must not be executed to ensure the accur acy of conversion results. also, duri ng ad conversion, do not input signals that fluctuate widely to pins near analog input pins. note: an asterisk (*) indicates that either ?1? or ?0? can be set. table 5-4 register programming for port p1 (p10 to p17) function programmed value p1dr p1cr1 p1cr2 port input * ?0? ?1? analog input, key-on wake-up input * ?0? ?0? port ?0? output ?0? ?1? * port "1" output ?1? ?1? * table 5-5 values read from p1dr according to register programming conditions values read from p1dr p1cr1 p1cr2 ?0? ?0? ?0? ?0? ?1? pin state ?1? ?0? output latch state ?1?
page 56 5. i/o ports 5.2 port p1 (p10 to p17) TMP86FS28FG figure 5-3 port p1 note 1: pins set to input mode read the pin input data. therefore, when both input and output modes are used in port p1, the contents of the output latch of a pin set to input mode may be overwritten by a bit manipulation instruction. note 2: for a pin used as an analog input, be sure to clear the corresponding bit in p1cr2 to "0" to prevent flow-through current. note 3: for a pin used as an analog input, do not set p1cr1 to "1" (port output) to prevent the pin from becoming shorted with an external signal. note 4: pins not used as analog inputs c an be used as input/output pins. during ad conversion, however, output instruc- tions must not be executed to ensure the accuracy of conv ersion results. also, during ad conversion, do not input signals that fluctuate widely to pins near analog input pins. data output (p1dr) data input (p1dr) stop outen ainds sain p1cr2i input p1cr1i input p  cr2i p1cr1i p1i note 1) i = 0, 1, 6, 7 : j = 2~5 : k = 2~5 note 2) stop = bit 7 in syscr1 note 3) sain = ad input select signal note 4) stopk = input select signal for key-on wake-up key-on wake-up data output (p1dr) data input (p1dr) stop stopk outen ainds sain p1cr2j input p1cr1j input p1cr2j p1cr1j p1j dq dq dq dq dq dq analog input analog input
page 57 TMP86FS28FG p1dr (0001h) r/w 76543210 p17 ain7 p16 ain6 p15 ain5 stop5 p14 ain4 stop4 p13 ain3 stop3 p12 ain2 stop2 p11 ain1 p10 ain0 (initial value: 0000 0000) p1cr1 (0ff9h) 76543210 (initial value: 0000 0000) p1cr1 port p1 input/output control (set for each bit individually) 0: port input, key-on wake-up input, analog input 1: port output r/w p1cr2 (0ffah) 76543210 (initial value: 1111 1111) p1cr2 port p1 input control (set for each bit individually) 0: analog input, key-on wake-up input 1: port input r/w
page 58 5. i/o ports 5.3 port p2 (p20 to p22) TMP86FS28FG 5.3 port p2 (p20 to p22) port p2 is a 3-bit input/output port that can also be used for external interrupt input, stop mode release signal input, or low-frequency resonator connection. to use port p2 as an input port or function pins, set the ou tput latch (p2dr) to ?1?. a reset initializes p2dr to ?1?. in the dual clock mode, pins p21 (xti n) and p22 (xout) are co nnected with a low-frequency resonator (32.768 khz). in the single clock mode, pins p21 and p22 can be used as normal input/output port pins. it is recommended that pin p20 be used as an external interrupt input, stop release signal input, or input port. (when p20 is used as an output port, the interrupt la tch is set on the falling edge of the output pulse.) port p2 has a separate data input register. the output latch state can be read from the p2dr register, and the pin state can be read from the p2prd register. when a read instruction is executed on p2dr or p2prd, bits 7 to 3 are read as undefined. figure 5-4 port p2 note: since pin p20 is also used as a stop pin, the output of p20 becomes high-impedance in stop mode regardless of the outen state. p2dr (0002h) r/w 76543210 p22 xtout p21 xtin p20 int5 stop (initial value: **** *111) p2prd (0ff2h) read only 76543210 p22 p21 p20 data input (p20prd) output latch read (p21) data output (p21) data output (p20) data input (p20) data input (p21prd) output latch read (p22) data input (p22prd) data output (p22) stop outen xten fs p22 (xtout) p21 (xtin) p20 (int5, stop) control input output latch output latch output latch osc. enable dq dq dq
page 59 TMP86FS28FG 5.4 port p3 (p30 to p37) port p3 is an 8-bit input/output port that can also be used for external interrupt input, divider output, timer/counter input, serial interface input/o utput, or uart input/output. a reset initializes the output latch (p3dr) to ?1? and the pch control (p3outcr) to ?0?. to use a pin in port p3 as an external interrupt input, timer/counter input, serial inte rface input, or uart input, set p3dr to ?1? and then set the corresponding bit in p3outcr to ?0?. to use a pin in port p3 as a di vider output, seri al interface output, or uart output, set p3dr to ?1?. port 3 can be used for either sio or uart, so be sure not to enable both of these functions at the same time. the output circuit of port p3 can be se t either as sink open-drain output (?0?) or cmos output (?1?) individually for each bit in p3outcr. port p3 has a separate data input register. the output latch state can be read from the p3dr register, and the pin state can be read from the p3prd register. figure 5-5 port p3 table 5-6 register programming for port p3 (p30 to p37) function programmed value p3dr p3outcr port input, external interrupt input, timer/counter input, serial interface input, uart input ?1? ?0? port ?0? output ?0? set as appropriate. port ?1? output, serial interface output, uart output, divider output ?1? data input (p3prd) output latch read (p3dr) stop outen p3outcri input data output (p3dr) p3outcri p3i note) i = 7~0 control output control input output latch dq dq
page 60 5. i/o ports 5.4 port p3 (p30 to p37) TMP86FS28FG p3dr (0003h) r/w 76543210 p37 tc10 int4 p36 sck p35 si txd1 p34 so rxd1 p33 p32 p31 dvo p30 int0 (initial value: 1111 1111) p3outcr (002bh) 76543210 (initial value: 0000 0000) p3outcr port p3 output circuit control (set for each bit individually) 0: sink open-drain output 1: cmos output r/w p3prd (0ff3h) read only 76543210 p37 p36 p35 p34 p33 p32 p31 p30
page 61 TMP86FS28FG 5.5 port p4 (p40 to p47) port p4 is an 8-bit input/output port that can also be us ed for external interrupt input, ppg output, timer/counter input, or lcd segment output. a reset initializes the output latch (p4dr) to ?1?, the pc h control (p4outcr) to ?0?, and the lcd output control register (p4lcr) to ?0?. to use a pin in port p4 as an input port, external interrupt input, or timer/counter input, set p4dr to ?1? and then set the corresponding bit in p4lcr and p4outcr to ?0?. to use a pin in port p4 as an lcd segment ou tput, set the corresponding bit in p4lcr to ?1?. to use a pin in port p4 as a ppg out put, set p4dr to ?1? and then set th e corresponding bit in p4lcr to ?0?. the output circuit of port p4 can be se t either as sink open-drain outut (?0?) or cmos output (?1?) individually for each bit in p4outcr. port p4 has a separate data input register. the output latch state can be read from the p4dr register, and the pin state can be read from the p4prd register. note: an asterisk (*) indicates that either ?1? or ?0? can be set. figure 5-6 port p4 table 5-7 register programming for port p4 (p40 to p47) function programmed value p4dr p4outcr p4lcr port input, external interrupt input, timer/counter input ?1? ?0? ?0? port "0" output ?0? set as appropriate. ?0? port ?1? output ?1? ?0? ppg output ?1? ?0? lcd segment output * * ?1? data input (p4prd) output latch read (p4dr) stop outen p4outcri input data output (p4dr) p4outcri p4i note) i = 7~0 dq dq lcd data output p4lcri dq p4lcri input control output control input output latch
page 62 5. i/o ports 5.5 port p4 (p40 to p47) TMP86FS28FG p4dr (0004h) r/w 76543210 p47 seg32 p46 seg31 p45 seg30 p44 seg29 p43 seg28 tc11 p42 seg27 ppg1 p41 seg26 int2 p40 seg25 int1 (initial value: 0000 0000) p4lcr (0fd4h) 76543210 (initial value: 0000 0000) p4lcr port p4 segment output control (set for each bit individually) 0: input/output port 1: lcd segment output r/w p4outcr (0ffbh) 76543210 (initial value: 0000 0000) p4outcr p4 output circuit control (set for each bit individually) 0: sink open-drain output 1: cmos output r/w p4prd (0ff4h) read only 76543210 p47 p46 p45 p44 p43 p42 p41 p40
page 63 TMP86FS28FG 5.6 port p5 (p50 to p57) port p5 is an 8-bit input/output port that can also be used for timer/counter input/output, lcd segment output, or uart input/output. a reset initializes the output latch (p5dr) to ?1?, the pc h control (p5outcr) to ?0?, and the lcd output control register (p5lcr) to ?0?. to use a pin in port p5 as an input port, timer/counter i nput, or uart input, set p5dr to ?1? and then set the cor- responding bit in p5lcr and p5outcr to ?0?. to use a pin in port p5 as an lcd segment ou tput, set the corresponding bit in p5lcr to ?1?. to use a pin in port p5 as a uart output or timer/counter output, set p5dr to "1" and then set the corresponding bit in p5lcr to ?0?. the output circuit of port p5 can be se t either as sink open-drain output (?0?) or cmos otuput (?1?) individually for each bit in p5outcr. port p5 has a separate data input register. the output latch state can be read from the p5dr register, and the pin state can be read from the p5prd register. note: an asterisk (*) indicates that either ?1? or ?0? can be set. figure 5-7 port p5 table 5-8 register programming for port p5 (p50 to p57) function programmed value p5dr p5outcr p5lcr port input, uart input, timer/counter input ?1? ?0? ?0? port ?0? output ?0? set as appropriate. ?0? port ?1? output, uart output ?1? ?0? lcd segment output * * ?1? data input (p5prd) output latch read (p5dr) stop outen p5outcri input data output (p5dr) p5outcri p5i note) i = 7~0 dq dq lcd data output p5lcri dq p5lcri input control output control input output latch
page 64 5. i/o ports 5.6 port p5 (p50 to p57) TMP86FS28FG p5dr (0005h) r/w 76543210 p57 seg24 p56 seg25 p55 seg26 tc6 pwm6 pdo6 p54 seg27 tc5 pwm5 pdo5 p53 seg28 tc4 pwm4 pdo4 p52 seg29 tc3 pwm3 pdo3 p51 seg30 rxd0 p50 seg31 txd0 (initial value: 0000 0000) p5lcr (0fd5h) 76543210 (initial value: 0000 0000) p5lcr port p5 segment output control (set for each bit individually) 0: input/output port 1: lcd segment output r/w p5outcr (0ffch) 76543210 (initial value: 0000 0000) p5outcr port p5 input/output control (set for each bit individually) 0: sink open-drain output 1: cmos output r/w p5prd (0ff5h) 76543210 p57 p56 p55 p54 p53 p52 p51 p50 read only
page 65 TMP86FS28FG 5.7 port p6 (p60 to p67) port p6 is an 8-bit input/output port that can also be used for lcd segment output. a reset initializes the output latch (p6dr) to ?1?, the pc h control (p6outcr) to ?0?, and the lcd output control register (p6lcr) to ?0?. to use a pin in port p6 as an input port, set p6dr to ?1? and then set the corr esponding bit in p6lcr and p6outcr to ?0?. to use a pin in port p6 as an lcd segment ou tput, set the corresponding bit in p6lcr to ?1?. the output circuit of port p6 can be se t either as sink open-drain output (?0?) or cmos output (?1?) individually for each bit in p6outcr. port p6 has a separate data input register. the outut latc h state can be read from the p6dr register, and the pin state can be read from the p6prd register. note: an asterisk (*) indicates that either ?1? or ?0? can be set. figure 5-8 port p6 table 5-9 register programming for port p6 (p60 to p67) function programmed value p6dr p6outcr p6lcr port input ?1? ?0? ?0? port "0" output ?0? set as appropriate. ?0? port ?1? output ?1? ?0? lcd segment output * * ?1? data input (p6prd) output latch read (p6dr) stop outen p6outcri input data output (p6dr) p6outcri p6i note) i = 7~0 dq dq lcd data output p6lcri dq p6lcri input output latch
page 66 5. i/o ports 5.7 port p6 (p60 to p67) TMP86FS28FG p6dr (0006h) r/w 76543210 p67 seg16 p66 seg17 p65 seg18 p64 seg19 p63 seg20 p62 seg21 p61 seg22 p60 seg23 (initial value: 0000 0000) p6lcr (0fd6h) 76543210 (initial value: 0000 0000) p6lcr port p6 segment output control (set for each bit individually) 0: input/output port 1: segment output r/w p6outcr (0ffdh) 76543210 (initial value: 1111 1111) p6cr2 port p6 input/output control (set for each bit individually) 0: sink open-drain output 1: cmos output r/w p6prd (0ff6h) 76543210 p67 p66 p65 p64 p63 p62 p61 p60 read only
page 67 TMP86FS28FG 5.8 port p7 (p70 to p77) port p7 is an 8-bit input/output port that can also be used for lcd segment output. a reset initializes the output latch (p7dr) to ?1?, the pc h control (p7outcr) to ?0?, and the lcd output control register (p7lcr) to ?0?. to use a pin in port p7 as an input port, set p7dr to ?1? and then set the corr esponding bit in p7lcr and p7outcr to ?0?. to use a pin in port p7 as an lcd segment ou tput, set the corresponding bit in p7lcr to ?1?. the output circuit of port p7 can be se t either as sink open-drain output (?0?) or cmos output (?1?) individually for each bit in p7outcr. port p7 has a separate data input register. the output latch state can be read from the p7dr register, and the pin state can be read from the p7prd register. note: an asterisk (*) indicates that either ?1? or ?0? can be set. figure 5-9 port p7 table 5-10 register programming for port p7 (p70 to p77) function programmed value p7dr p7outcr p7lcr port input ?1? ?0? ?0? port ?0? output ?0? set as appropriate. ?0? port ?1? output ?1? ?0? lcd segment output * * ?1? data input (p7prd) output latch read (p7dr) stop outen p7outcri input data output (p7dr) p7outcri p7i note) i = 7~0 dq dq lcd data output p7lcri dq p7lcri input output latch
page 68 5. i/o ports 5.8 port p7 (p70 to p77) TMP86FS28FG p7dr (0007h) r/w 76543210 p77 seg8 p76 seg9 p75 seg10 p74 seg11 p73 seg12 p72 seg13 p71 seg14 p70 seg15 (initial value: 0000 0000) p7lcr (0fd7h) 76543210 (initial value: 0000 0000) p7lcr port p7 segment output control (set for each bit individually) 0: input/output port 1: segment output r/w p7outcr (0ffeh) 76543210 (initial value: 0000 0000) p7outcr port p7 input/output control (set for each bit individually) 0: sink open-drain output 1: cmos output r/w p7prd (0ff7h) 76543210 p77 p76 p75 p74 p73 p72 p71 p70 read only
page 69 TMP86FS28FG 5.9 port p8 (p80 to p87) port p8 is an 8-bit input/output port that can also be used for lcd segment output. a reset initializes the output latch (p8dr) to ?1?, the pc h control (p8outcr) to ?0?, and the lcd output control register (p8lcr) to ?0?. to use a pin in port p8 as an input port, set p8dr to ?1? and then set the corr esponding bit in p8lcr and p8outcr to ?0?. to use a pin in port p8 as an lcd segment ou tput, set the corresponding bit in p8lcr to ?1?. the output circuit of port p8 can be se t either as sink open-drain output (?0?) or cmos output (?1?) individually for each bit in p8outcr. port p8 has a separate data input register. the output latch state can be read from the p8dr register, and the pin state can be read from the p8prd register. note: an asterisk (*) indicates that either ?1? or ?0? can be set. figure 5-10 port p8 table 5-11 register programming for port p8 (p80 to p87) function port input p8dr p8outcr p8lcr port input ?1? ?0? ?0? port ?0? output ?0? set as appropriate. ?0? port ?1? output ?1? ?0? lcd segment output * * ?1? data input (p8prd) output latch read (p8dr) stop outen p8outcri input data output (p8dr) p8outcri p8i note) i = 7~0 dq dq lcd data output p8lcri dq p8lcri input output latch
page 70 5. i/o ports 5.9 port p8 (p80 to p87) TMP86FS28FG p8dr (0008h) r/w 76543210 p87 seg0 p86 seg1 p85 seg2 p84 seg3 p83 seg4 p82 seg5 p81 seg6 p80 seg7 (initial value: 0000 0000) p8lcr (0fd8h) 76543210 (initial value: 0000 0000) p8lcr port p8 segment output control (set for each bit individually) 0: input/output port 1: lcd segment output r/w p8outcr (0fffh) 76543210 (initial value: 0000 0000) p8outcr port p8 input/output control (set for each bit individually) 0: sink open-drain output 1: cmos output r/w p8prd (0ff8h) 76543210 p87 p86 p85 p84 p83 p82 p81 p80 read only
page 71 TMP86FS28FG 6. watchdog timer (wdt) the watchdog timer is a fail-safe system to detect rapidl y the cpu malfunctions such as endless loops due to spu- rious noises or the deadlock conditions, and return the cpu to a sy stem recovery routine. the watchdog timer signal for detecting malfunctions can be programmed only once as ?reset request? or ?inter- rupt request?. upon the reset release, this signal is initialized to ?reset request?. when the watchdog timer is not used to detect malfunctions, it can be used as the timer to provide a periodic inter- rupt. note: care must be taken in system des ign since the watchdog timer functions are not be operated completely due to effect of disturbing noise. 6.1 watchdog timer configuration figure 6-1 watchdog timer configuration 0034 h overflow wdt output internal reset binary counters wdtout writing clear code writing disable code wdten wdtt 2 0035 h watchdog timer control registers wdtcr1 wdtcr2 intwdt interrupt request interrupt request reset request reset release clock clear 1 2 controller q sr s r q selector fc/2 23 or fs/2 15 fc/2 21 or fs/2 13 fc/2 19 or fs/2 11 fc/2 17 or fs/2 9
page 72 6. watchdog timer (wdt) 6.2 watchdog timer control TMP86FS28FG 6.2 watchdog timer control the watchdog timer is controlled by the watchdog timer control registers (wdtcr1 and wdtcr2). the watch- dog timer is automatically enabled after the reset release. 6.2.1 malfunction detection me thods using the watchdog timer the cpu malfunction is detected, as shown below. 1. set the detection time, select the output, and clear the binary counter. 2. clear the binary counter repeatedly within the specified detection time. if the cpu malfunctions such as en dless loops or the deadlock condition s occur for some reason, the watch- dog timer output is activated by the binary-counter overflow unless the binary counters are cleared. when wdtcr1 is set to ?1? at this time, the reset request is generated and then internal hardware is initialized. when wdtcr1 is set to ?0?, a watchdog timer interrupt (intwdt) is generated. the watchdog timer temporarily stops counting in th e stop mode including the warm-up or idle/sleep mode, and automatically restarts (continues counting) when the stop/idle/sleep mode is inactivated. note:the watchdog timer consists of an internal divider and a two-stage binary counter. when the clear code 4eh is written, only the binary counter is cleared, but not the internal divider . the minimum binary-counter overflow time, that depends on the timing at which the clear code (4eh) is written to the wdtcr2 register, may be 3/ 4 of the time set in wdtcr1. therefore, writ e the clear code using a cycle shorter than 3/4 of the time set to wdtcr1. example :setting the watchdog timer detection time to 2 21 /fc [s], and resetting the cpu malfunction detection ld (wdtcr2), 4eh : clears the binary counters. ld (wdtcr1), 00001101b : wdtt m 10, wdtout m 1 ld (wdtcr2), 4eh : clears the binary counters (always clears immediately before and after changing wdtt). within 3/4 of wdt detection time : : ld (wdtcr2), 4eh : clears the binary counters. within 3/4 of wdt detection time : : ld (wdtcr2), 4eh : clears the binary counters.
page 73 TMP86FS28FG note 1: after clearing wdtout to ?0?, the program cannot set it to ?1?. note 2: fc: high-frequency clock [hz], fs : low-frequency clock [hz], *: don?t care note 3: wdtcr1 is a write-only register and must not be used with any of read-modify-write instructions. if wdtcr1 is read, a don?t care is read. note 4: to activate the stop mode, disable the watchdog timer or clear the counter immediately before entering the stop mode. after clearing the counter, clear the counter again immediately after the stop mode is inactivated. note 5: to clear wdten, set the register in accordance wi th the procedures shown in ?6.2.3 watchdog timer disable?. note 1: the disable code is valid only when wdtcr1 = 0. note 2: *: don?t care note 3: the binary counter of the watchdog timer must not be cleared by the interrupt task. note 4: write the clear code 4eh using a cycle shor ter than 3/4 of the time set in wdtcr1. 6.2.2 watchdog timer enable setting wdtcr1 to ?1? enables the watc hdog timer. since wdtcr1 is initialized to ?1? during reset, the watchdog timer is enabled automatically after the reset release. watchdog timer control register 1 wdtcr1 (0034h) 76543210 (atas) (atout) wdten wdtt wdtout (initial value: **11 1001) wdten watchdog timer enable/disable 0: disable (writing the disable code to wdtcr2 is required.) 1: enable write only wdtt watchdog timer detection time [s] normal1/2 mode slow1/2 mode write only dv7ck = 0 dv7ck = 1 00 2 25 /fc 2 17 /fs 2 17 /fs 01 2 23 /fc 2 15 /fs 2 15 fs 10 2 21 fc 2 13 /fs 2 13 fs 11 2 19 /fc 2 11 /fs 2 11 /fs wdtout watchdog timer output select 0: interrupt request 1: reset request write only watchdog timer control register 2 wdtcr2 (0035h) 76543210 (initial value: **** ****) wdtcr2 write watchdog timer control code 4eh: clear the watchdog timer binary counter (clear code) b1h: disable the watchdog timer (disable code) d2h: enable assigning address trap area others: invalid write only
page 74 6. watchdog timer (wdt) 6.2 watchdog timer control TMP86FS28FG 6.2.3 watchdog timer disable to disable the watchdog timer, set the register in accordance with the fo llowing procedures . setting the reg- ister in other procedures causes a malfunction of the microcontroller. 1. set the interrupt master flag (imf) to ?0?. 2. set wdtcr2 to the clear code (4eh). 3. set wdtcr1 to ?0?. 4. set wdtcr2 to the disable code (b1h). note:while the watchdog timer is disabled, the binary counters of the watchdog timer are cleared. 6.2.4 watchdog time r interrupt (intwdt) when wdtcr1 is cleared to ?0?, a watchdog timer interrupt request (intwdt) is generated by the binary-counter overflow. a watchdog timer interrupt is the non-maskable interr upt which can be accepted regardless of the interrupt master flag (imf). when a watchdog timer interrupt is generated while the other interrupt including a watchdog timer interrupt is already accepted, the new watchdog timer interrupt is processed immediately and the previous interrupt is held pending. therefore, if watchdog timer interrupts are generated continuously without execution of the retn instruction, too many levels of nesting may cause a malfunction of the microcontroller. to generate a watchdog timer interrupt, set the stack pointer before setting wdtcr1. example :disabling the watchdog timer di : imf m 0 ld (wdtcr2), 04eh : clears the binary counter ldw (wdtcr1), 0b101h : wdten m 0, wdtcr2 m disable code table 6-1 watchdog timer detection time (example: fc = 16.0 mhz, fs = 32.768 khz) wdtt watchdog timer detection time[s] normal1/2 mode slow mode dv7ck = 0 dv7ck = 1 00 2.097 4 4 01 524.288 m 1 1 10 131.072 m 250 m 250 m 11 32.768 m 62.5 m 62.5 m example :setting watchdog timer interrupt ld sp, 083fh : sets the stack pointer ld (wdtcr1), 00001000b : wdtout m 0
page 75 TMP86FS28FG 6.2.5 watchdog timer reset when a binary-counter overflow occurs while wdt cr1 is set to ?1?, a watchdog timer reset request is generated. when a watchdog timer reset request is generated, the internal hardware is reset. the reset time is maximum 24/fc [s] (1.5 p s @ fc = 16.0 mhz). note:when a watchdog timer reset is generated in the sl ow1 mode, the reset time is maximum 24/fc (high-fre- quency clock) since the high-frequency cl ock oscillator is restarted. however, when crystals have inaccura- cies upon start of the high-frequency clock oscillator, the reset time should be considered as an approximate value because it has slight errors. figure 6-2 watchdog timer interrupt clock binary counter overflow intwdt interrupt request (wdtcr1= "0") 2 17 /fc 2 19 /fc [s] (wdtt=11) write 4e h to wdtcr2 1 2 30 1 2 3 0 internal reset (wdtcr1= "1") a reset occurs
page 76 6. watchdog timer (wdt) 6.3 address trap TMP86FS28FG 6.3 address trap the watchdog timer control register 1 and 2 share the a ddresses with the control regi sters to generate address traps. 6.3.1 selection of address tr ap in internal ram (atas) wdtcr1 specifies whether or not to generate address traps in the inte rnal ram area. to execute an instruction in the internal ram area, clear wdtcr1 to ?0?. to enable the wdtcr1 set- ting, set wdtcr1 and then write d2h to wdtcr2. executing an instruction in the sfr or dbr area generates an address trap unconditionally regardless of the setting in wdtcr1. 6.3.2 selection of operati on at address trap (atout) when an address trap is generated, either the inte rrupt request or the reset request can be selected by wdtcr1. 6.3.3 address trap interrupt (intatrap) while wdtcr1 is ?0?, if the cpu should start looping for some cause such as noise and an attempt be made to fetch an instruction from the on-chip ram (while wdtcr1 is ?1?), dbr or the sfr area, address trap interrupt (intatrap) will be generated. an address trap interrupt is a non-maskable interrupt which can be accepted regardless of the interrupt mas- ter flag (imf). when an address trap interrupt is generated while the other interrupt including an address trap interrupt is already accepted, the new address trap is processed immediately and the previous interrupt is held pending. therefore, if address trap interrupts are generated continuously without execution of the retn instruction, too many levels of nesting may cause a malfunction of the microcontroller. to generate address trap interrupts, set the stack pointer beforehand. watchdog timer control register 1 wdtcr1 (0034h) 7654 3 21 0 atas atout (wdten) (wdtt) (wdtout) (initial value: **11 1001) atas select address trap generation in the internal ram area 0: generate no address trap 1: generate address traps (after setting atas to ?1?, writing the control code d2h to wdtcr2 is required) write only atout select operation at address trap 0: interrupt request 1: reset request watchdog timer control register 2 wdtcr2 (0035h) 76543210 (initial value: **** ****) wdtcr2 write watchdog timer control code and address trap area control code d2h: enable address trap area selection (atrap control code) 4eh: clear the watchdog timer binary counter (wdt clear code) b1h: disable the watchdog timer (wdt disable code) others: invalid write only
page 77 TMP86FS28FG 6.3.4 address trap reset while wdtcr1 is ?1?, if the cpu should start looping for some cause such as noise and an attempt be made to fetch an instruction from the on-chip ram (while wdtcr1 is ?1?), dbr or the sfr area, address trap reset will be generated. when an address trap reset request is generated, the in ternal hardware is reset. the reset time is maximum 24/fc [s] (1.5 p s @ fc = 16.0 mhz). note:when an address trap reset is generated in the slow1 mode, the reset time is maximum 24/fc (high-fre- quency clock) since the high-frequency cl ock oscillator is restarted. however, when crystals have inaccura- cies upon start of the high-frequency clock oscillator, the reset time should be considered as an approximate value because it has slight errors.
page 78 6. watchdog timer (wdt) 6.3 address trap TMP86FS28FG
page 79 TMP86FS28FG 7. time base timer (tbt) the time base timer generates time base for key scanning, dynamic displaying, etc. it also provides a time base timer interrupt (inttbt). 7.1 time base timer 7.1.1 configuration figure 7-1 time base timer configuration 7.1.2 control time base timer is controlled by time base timer control register (tbtcr). note 1: fc; high-frequency clock [hz], fs ; low-frequency clock [hz], *; don't care time base timer control register 7 6543210 tbtcr (0036h) (dvoen) (dvock) (dv7ck) tbten tbtck (initial value: 0000 0000) tbten time base timer enable / disable 0: disable 1: enable tbtck time base timer interrupt frequency select : [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 23 fs/2 15 fs/2 15 001 fc/2 21 fs/2 13 fs/2 13 010 fc/2 16 fs/2 8 ? 011 fc/2 14 fs/2 6 ? 100 fc/2 13 fs/2 5 ? 101 fc/2 12 fs/2 4 ? 110 fc/2 11 fs/2 3 ? 111 fc/2 9 fs/2 ? fc/2 23 or fs/2 15 fc/2 21 or fs/2 13 fc/2 16 or fs/2 8 fc/2 14 or fs/2 6 fc/2 13 or fs/2 5 fc/2 12 or fs/2 4 fc/2 11 or fs/2 3 fc/2 9 or fs/2 tbtcr tbten tbtck 3 mpx source clock falling edge detector time base timer control register inttbt interrupt request idle0, sleep0 release request
page 80 7. time base timer (tbt) 7.1 time base timer TMP86FS28FG note 2: the interrupt frequency (tbtck) must be selected with t he time base timer disabled (tbten="0"). (the interrupt fre- quency must not be changed with the disable from the enable state.) both frequency selection and enabling can be per- formed simultaneously. 7.1.3 function an inttbt ( time base timer interrupt ) is generated on the first falling edge of source clock ( the divider output of the timing generator which is selected by tb tck. ) after time base timer has been enabled. the divider is not cleared by the progra m; therefore, only the first interrupt may be generated ahead of the set interrupt period ( figure 7-2 ). figure 7-2 time base timer interrupt example :set the time base timer frequency to fc/2 16 [hz] and enable an inttbt interrupt. ld (tbtcr) , 00000010b ; tbtck m 010 ld (tbtcr) , 00001010b ; tbten m 1 di ; imf m 0 set (eirl) . 6 table 7-1 time base timer interrupt frequency ( example : fc = 16.0 mhz, fs = 32.768 khz ) tbtck time base timer interrupt frequency [hz] normal1/2, idle1/2 mode normal1/2, idle1/2 mode slow1/2, sleep1/2 mode dv7ck = 0 dv7ck = 1 000 1.91 1 1 001 7.63 4 4 010 244.14 128 ? 011 976.56 512 ? 100 1953.13 1024 ? 101 3906.25 2048 ? 110 7812.5 4096 ? 111 31250 16384 ? source clock enable tbt interrupt period tbtcr inttbt
page 81 TMP86FS28FG 7.2 divider output ( dvo ) approximately 50% duty pulse can be output using the divider output circuit, which is useful for piezoelectric buzzer drive. divider output is from dvo pin. 7.2.1 configuration figure 7-3 divider output 7.2.2 control the divider output is controlled by the time base timer control register. note: selection of divider output frequency (dvock) must be made whil e divider output is disabled (dvoen="0"). also, in other words, when changing the state of the divider output frequen cy from enabled (dvoen="1") to disable(dvoen="0"), do not change the setting of the divider output frequency. time base timer control register 7654 321 0 tbtcr (0036h) dvoen dvock (dv7ck) (tbten) (tbtck) (initial value: 0000 0000) dvoen divider output enable / disable 0: disable 1: enable r/w dvock divider output ( dvo ) frequency selection: [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 00 fc/2 13 fs/2 5 fs/2 5 01 fc/2 12 fs/2 4 fs/2 4 10 fc/2 11 fs/2 3 fs/2 3 11 fc/2 10 fs/2 2 fs/2 2 tbtcr output latch port output latch mpx dvoen tbtcr dvo pin output dvock divider output control register (a) configuration (b) timing chart data output 2 a b c y d s d q dvo pin fc/2 13 or fs/2 5 fc/2 12 or fs/2 4 fc/2 11 or fs/2 3 fc/2 10 or fs/2 2
page 82 7. time base timer (tbt) 7.2 divider output (dvo) TMP86FS28FG example :1.95 khz pulse output (fc = 16.0 mhz) ld (tbtcr) , 00000000b ; dvock m "00" ld (tbtcr) , 10000000b ; dvoen m "1" table 7-2 divider output frequency ( exam ple : fc = 16.0 mhz, fs = 32.768 khz ) dvock divider output frequency [hz] normal1/2, idle1/2 mode slow1/2, sleep1/2 mode dv7ck = 0 dv7ck = 1 00 1.953 k 1.024 k 1.024 k 01 3.906 k 2.048 k 2.048 k 10 7.813 k 4.096 k 4.096 k 11 15.625 k 8.192 k 8.192 k
page 83 TMP86FS28FG 8. 16-bit timercounter (tc10,tc11) 8.1 16-bit timercounter 10 8.1.1 configuration figure 8-1 timercounter 10 (tc10) :::?:w :w pin tc1 :?:w:?::? mett10 start capture clear source :w :w clock ppg output mode write to tc10cr 16-bit up-counter clear tc10drb selector tc10dra tc10cr tc10 control register match inttc10 interript tff10 acap10 tc10ck window mode set t oggl e q 2 t oggl e set clear q y a d b c s b a y s tc10s clear mppg10 ppg output mode internal reset s enable mcap10 s y a b tc10s 2 set clear command start decoder external trigger start edge detector note: function i/o may not operate depending on i/o port setting. for more details, see the chapter "i/o port". port (note) q pulse width measurement mode falling rising trigger external cmp 16-bit timer register a, b pulse width measurement mode port (note) fc/2 11, fs/2 3 fc/2 7 fc/2 3
page 84 8. 16-bit timercounter (tc10,tc11) 8.1 16-bit timercounter 10 TMP86FS28FG 8.1.2 timercounter control the timercounter 10 is controlled by the timercounter 10 control register (tc10cr) and two 16-bit timer registers (tc10dra and tc10drb). note 1: fc: high-frequency clock [hz], fs: low-frequency clock [hz] note 2: the timer register consists of two shift registers. a va lue set in the timer register becomes valid at the rising edge o f the first source clock pulse that occurs after the upper byte (tc10drah and tc10drbh) is written. therefore, write the lower byte and the upper byte in this order (it is recommended to write the register with a 16-bit access instruction). writing only the lower byte (tc10dral and tc10drbl) does not enable the setting of the timer register. note 3: to set the mode, source clock, ppg output control and timer f/f control, write to tc10cr1 during tc10s=00. set the timer f/f10 control until the first ti mer start after setting the ppg mode. timer register 1514131211109876543210 tc10dra (0011h, 0010h) tc10drah (0011h) tc10dral (0010h) (initial value: 1111 1111 1111 1111) read/write tc10drb (0013h, 0012h) tc10drbh (0013h) tc10drbl (0012h) (initial value: 1111 1111 1111 1111) read/write (write e nabled only in the ppg output mode) timercounter 10 control register tc10cr (0014h) 7 6 543210 tff10 acap10 mcap10 mett10 mppg10 tc10s tc10ck tc10m read/write (initial value: 0000 0000) tff10 timer f/f10 control 0: clear 1: set r/w acap10 auto capture control 0:auto-capture disable 1:auto-capture enable r/w mcap10 pulse width measure- ment mode control 0:double edge capture 1:single edge capture mett10 external trigger timer mode control 0:trigger start 1:trigger start and stop mppg10 ppg output control 0:continuous pulse generation 1:one-shot tc10s tc10 start control timer extrig- ger event win- dow pulse ppg r/w 00: stop and counter clear oooooo 01: command start o????o 10: rising edge start (ex-trigger/pulse/ppg) rising edge count (event) positive logic count (window) ? ooooo 11: falling edge start (ex-trigger/pulse/ppg) falling edge count (event) negative logic count (window) ? ooooo tc10ck tc10 source clock select [hz] normal1/2, idle1/2 mode divider slow, sleep mode r/w dv7ck = 0 dv7ck = 1 00 fc/2 11 fs/2 3 dv9 fs/2 3 01 fc/2 7 fc/2 7 dv5 ? 10 fc/2 3 fc/2 3 dv1 ? 11 external clock (tc10 pin input) tc10m tc10 operating mode select 00: timer/external trigger timer/event counter mode 01: window mode 10: pulse width measurement mode 11: ppg (programmable pulse generate) output mode r/w
page 85 TMP86FS28FG note 4: auto-capture can be used only in t he timer, event counter, and window modes. note 5: to set the timer registers, the following relationship must be satisfied. tc10dra > tc10drb > 1 (ppg output mode), tc10dra > 1 (other modes) note 6: set tff10 to ?0? in the mode except ppg output mode. note 7: set tc10drb after setting tc10m to the ppg output mode. note 8: when the stop mode is entered, the start control (tc10s) is cleared to ?00? automatically , and the timer stops. after th e stop mode is exited, set the tc10s to use the timer counter again. note 9: use the auto-capture function in the operative condition of tc10. a captured value may not be fixed if it's read after t he execution of the timer stop or auto-capture disable. read the capture value in a capture enabled condition. note 10:since the up-counter value is captured into tc10drb by the source clock of up-counter after setting tc10cr to "1". therefore, to read the captured value, wait at leas t one cycle of the internal source clock before reading tc10drb for the first time. 8.1.3 function timercounter 10 has six types of operating modes: timer, external trigger timer, event counter, window, pulse width measurement, programmable pulse generator output modes. 8.1.3.1 timer mode in the timer mode, the up-counter counts up using the internal clock. when a match between the up-counter and the timer register 1a (tc10dra) value is detected , an inttc10 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter restarts counting. setting tc10cr to ?1? captures the up-counter value into the timer register 1b (tc10drb) with the auto-capture function. use th e auto-capture function in the operative condition of tc10. a captured value may not be fixed if it's read after the execution of the timer stop or auto-captu re disable. read the capture value in a capture enabled condition. since the up-counter value is captured into tc10drb by the source clock of up- counter after setting tc10cr to "1". therefore, to read the captured value, wait at l east one cycle of the internal source clock before reading tc10drb for the first time. table 8-1 internal source clock for timercounter 10 (example: fc 16 mhz, fs 32.768 khz) tc10ck normal1/2, idle1/2 mode slow, sleep mode dv7ck = 0 dv7ck = 1 resolution [ p s] maximum time setting [s] resolution [ p s] maximum time setting [s] resolution [ p s] maximum time set- ting [s] 00 128 8.39 244.14 16.0 244.14 16.0 01 8.0 0.524 8.0 0.524 ? ? 10 0.5 32.77 m 0.5 32.77 m ? ? example 1 :setting the timer mode with source clock fc/2 11 [hz] and generating an interrupt 1 second later (fc 16 mhz, tbtcr ?0?) ldw (tc10dra), 1e84h ; sets the timer register (1 s y 2 11 /fc 1e84h) di ; imf ?0? set (eirl). 7 ; enables inttc10 ei ; imf ?1? ld (tc10cr), 00000000b ; selects the source clock and mode ld (tc10cr), 00010000b ; starts tc10
page 86 8. 16-bit timercounter (tc10,tc11) 8.1 16-bit timercounter 10 TMP86FS28FG note: since the up-counter value is captured into tc10drb by t he source clock of up-counter after setting tc10cr to "1". therefore, to read the captured value, wait at least one cycle of the internal source clock before reading tc10drb for the first time. figure 8-2 timer mode timing chart example 2 :auto-capture ld (tc10cr), 01010000b ; acap10 m 1 :: ld wa, (tc10drb) ; reads the capture value match detect acap10 tc10drb tc10dra inttc10 interruput request source clock counter source clock counter ? (a) timer mode (b) auto-capture ? 7 6 3 4 5 0 timer start 1 2 3 2 1 4 0 counter clear capture n + 1 n n n m + 2 m + 1 m m capture m + 2 m + 1 n + 1 n m - 1 m - 1 m - 2 n - 1 n - 1 n - 1
page 87 TMP86FS28FG 8.1.3.2 external trigger timer mode in the external trigger timer mode, the up-counter starts counting by the input pulse triggering of the tc10 pin, and counts up at the edge of the internal cl ock. for the trigger edge used to start counting, either the rising or falling edge is defined in tc10cr. ? when tc10cr is set to ?1? (trigger start and stop) when a match between the up-c ounter and the tc10dra value is detected after the timer starts, the up-counter is cleared and halted and an intt c10 interrupt request is generated. if the edge opposite to trigger edge is de tected before detecting a match between the up- counter and the tc10dra, the up-counter is cleared and halted without generating an interrupt request. therefore, this mode can be used to detect exceeding the specified pulse by interrupt. after being halted, the up-counter restarts counting when the trigge r edge is detected. ? when tc10cr is set to ?0? (trigger start) when a match between the up-c ounter and the tc10dra value is detected after the timer starts, the up-counter is cleared and halted and an intt c10 interrupt request is generated. the edge opposite to the trigger edge has no ef fect in count up. the tr igger edge for the next counting is ignored if detecting it before de tecting a match between the up-counter and the tc10dra. since the tc10 pin input has the noise rejection, pulses of 4/fc [s] or less are rejected as noise. a pulse width of 12/fc [s] or more is required to ensure edge detection. the rejection ci rcuit is turned off in the slow1/2 or sleep1/2 mode, but a pulse width of one machine cycle or more is required. example 1 :generating an interrupt 1 ms after the rising edge of the input pulse to the tc10 pin (fc =16 mhz) ldw (tc10dra), 007dh ; 1ms y 2 7 /fc 7dh di ; imf ?0? set (eirl). 7 ; enables inttc10 interrupt ei ; imf ?1? ld (tc10cr), 00000100b ; selects the source clock and mode ld (tc10cr), 00100100b ; starts tc10 external trigger, mett10 0 example 2 :generating an interrupt when the low-level pulse with 4 ms or more width is input to the tc10 pin (fc =16 mhz) ldw (tc10dra), 01f4h ; 4 ms y 2 7 /fc 1f4h di ; imf ?0? set (eirl). 7 ; enables inttc10 interrupt ei ; imf ?1? ld (tc10cr), 00000100b ; selects the source clock and mode ld (tc10cr), 01110100b ; starts tc10 external trigger, mett10 0
page 88 8. 16-bit timercounter (tc10,tc11) 8.1 16-bit timercounter 10 TMP86FS28FG figure 8-3 external tri gger timer mode timing chart inttc10 interrupt request source clock up-counter tc10dra tc10 pin input inttc10 interrupt request source clock up-counter tc10dra tc10 pin input 0 at the rising edge (tc10s = 10) at the rising edge (tc10s = 10) (a) trigger start (mett10 = 0) count start match detect count start 0 1234 23 n (b) trigger start and stop (mett10 = 1) count start count start 0 123 m 0 n n 0 count clear note: m < n count clear 123 1 n m - 1 n - 1 match detect count clear
page 89 TMP86FS28FG 8.1.3.3 event counter mode in the event counter mode, the up-counter counts up at the edge of the input pulse to the tc10 pin. either the rising or falling edge of the input pulse is selected as the count up edge in tc10cr. when a match between the up-counter and the tc10dra value is detected, an inttc10 interrupt is generated and the up-counter is clear ed. after being cleared, the up-coun ter restarts coun ting at each edge of the input pulse to the tc10 pin. since a match between the up-counter and the value set to tc10dra is detected at the edge opposite to the selected e dge, an inttc10 interrupt request is generated after a match of the value at the edge opposite to the selected edge. two or more machine cycles are required for the low-or high-level pulse input to the tc10 pin. setting tc10cr to ?1? captures the up-count er value into tc10drb with the auto capture function. use the auto-capture function in the opera tive condition of tc10. a captured value may not be fixed if it's read after the execution of the timer stop or auto-capture di sable. read the capture value in a capture enabled condition. since the up-counter value is captured into tc10drb by the source clock of up-counter after setting tc10cr to "1". ther efore, to read the captu red value, wait at least one cycle of the internal source clock before reading tc10drb for the first time. figure 8-4 event c ounter mode timing chart table 8-2 input pulse width to tc10 pin minimum pulse width [s] normal1/2, idle1/2 mode slow1/2, sleep1/2 mode high-going 2 3 /fc 2 3 /fs low-going 2 3 /fc 2 3 /fs at the rising edge (tc10s = 10) inttc10 interrput request tc10 pin input up-counter tc10dra ? 2 1 0 n timer start 2 1 0 n match detect counter clear n - 1
page 90 8. 16-bit timercounter (tc10,tc11) 8.1 16-bit timercounter 10 TMP86FS28FG 8.1.3.4 window mode in the window mode, the up-counter counts up at the rising edge of the pulse that is logical anded product of the input pulse to the tc10 pin (window pulse) and the internal source clock. either the posi- tive logic (count up during high-going pulse) or ne gative logic (count up during low-going pulse) can be selected. when a match between the up-counter and the tc10dra value is detected, an inttc10 interrupt is generated and the up-counter is cleared. define the window pulse to the frequency which is sufficiently lower than the internal source clock pro- grammed with tc10cr. figure 8-5 window mode timing chart match detect tc10dra inttc10 interrput request interrput request internal clock counter tc10dra tc10 pin input internal clock counter tc10 pin input inttc10 (a) positive logic (tc10s = 10) (b) negative logic (tc10s = 11) ? ? match detect 1 0 7 47 5 46 31 2 1 0 7 5 3 6 2 0 2 3 counter clear timer start 890 1 9 timer start counter clear count start count stop count start count start count stop count start
page 91 TMP86FS28FG 8.1.3.5 pulse width measurement mode in the pulse width measurement mode, the up-counter st arts counting by the input pulse triggering of the tc10 pin, and counts up at the edge of the internal clock. either the rising or falling edge of the internal clock is selected as the trigger edge in tc10cr. either the single- or double-edge capture is selected as the trigger edge in tc10cr. ? when tc10cr is set to ?1? (single-edge capture) either high- or low-level inpu t pulse width can be measured. to measure the high-level input pulse width, set the rising edge to tc10cr. to measure the low-level input pulse width, set the falling edge to tc10cr. when detecting the edge opposite to the trigger edge used to start counting after the timer starts, the up-counter captures the up-counter value into tc10drb and generates an inttc10 interrupt request. the up-counter is cleared at th is time, and then restar ts counting when detect- ing the trigger edge used to start counting. ? when tc10cr is set to ?0? (double-edge capture) the cycle starting with either the high- or low-going input pulse can be measured. to mea- sure the cycle starting with the high-going pu lse, set the rising edge to tc10cr. to measure the cycle startin g with the low-going pulse, set the falling edge to tc10cr. when detecting the edge opposite to the trigger edge used to start counting after the timer starts, the up-counter captures the up-counter value into tc10drb and generates an inttc10 interrupt request. the up-counter continues co unting up, and captures the up-counter value into tc10drb and generates an inttc10 interrupt request when detecting the trigger edge used to start counting. the up-counter is cleared at this time, and then continues counting. note 1: the captured value must be read from tc10drb until the next trigger edge is detected. if not read, the captured value becomes a don?t care. it is recomm ended to use a 16-bit access instruction to read the captured value from tc10drb. note 2: for the single-edge capture, the counter after ca pturing the value stops at ?1? until detecting the next edge. therefore, the second captured value is ?1? larger than the captured value immediately after counting starts. note 3: the first captured value after the timer starts may be read incorrectively, therefore, ignore the first captured value.
page 92 8. 16-bit timercounter (tc10,tc11) 8.1 16-bit timercounter 10 TMP86FS28FG example :duty measurem ent (resolution fc/2 7 [hz]) clr (inttc10sw). 0 ; inttc10 service switch initial setting address set to convert inttc10sw at each inttc10 ld (tc10cr), 00000110b ; sets the tc10 mode and source clock di ; imf ?0? set (eirl). 7 ; enables inttc10 ei ; imf ?1? ld (tc10cr), 00100110b ; starts tc10 with an external trigger at mcap10 = 0 : pinttc10: cpl (inttc10sw). 0 ; inttc10 interrupt, inverts and tests inttc10 service switch jrs f, sinttc10 ld a, (tc10drbl) ; reads tc10drb (high-level pulse width) ld w,(tc10drbh) ld (hpulse), wa ; stores high-level pulse width in ram reti sinttc10: ld a, (tc10drbl) ; reads tc10drb (cycle) ld w,(tc10drbh) ld (width), wa ; stores cycle in ram : reti ; duty calculation : vinttc10: dw pinttc10 ; inttc10 interrupt vector width hpulse tc10 pin inttc10 interrupt request inttc10sw
page 93 TMP86FS28FG figure 8-6 pulse wi dth measurement mode tc10drb inttc10 interrupt request interrupt request tc10 pin input counter internal clock (mcap10 = "1") 23 n count start count start trigger (tc10s = "10") 1 3 2 1 4 0 n 0 capture n - 1 tc10drb inttc10 tc10 pin input counter internal clock (mcap10 = "0") 12 n count start count start (tc10s = "10") 3 2 1 4 0 n capture capture n + 1 m - 2 n + 3 n + 2 n + 1 m - 1 m0 m [application] high-or low-level pulse width measurement [application] (1) cycle/frequency measurement (2) duty measurement (a) single-edge capture (b) double-edge capture
page 94 8. 16-bit timercounter (tc10,tc11) 8.1 16-bit timercounter 10 TMP86FS28FG 8.1.3.6 programmable pulse generate (ppg) output mode in the programmable pulse generation (ppg) mode, an arbitrary duty pulse is generated by counting performed in the internal clock. to start the timer, tc10cr specifies either the edge of the input pulse to the tc10 pin or the command start. tc10 cr specifies whether a duty pulse is pro- duced continuously or not (one-shot pulse). ? when tc10cr is set to ?0? (continuous pulse generation) when a match between the up-counter and the tc10drb value is detected after the timer starts, the level of the ppg pin is inverted and an inttc10 interrupt request is generated. the up-counter continues counting. when a match between the up-counter and the tc10dra value is detected, the level of the ppg pin is inverted and an inttc10 interrupt request is generated. the up-counter is cleared at this time, and then continues counting and pulse generation. when tc10s is cleared to ?00? during ppg output, the ppg pin retains the level immediately before the counter stops. ? when tc10cr is set to ?1? (one-shot pulse generation) when a match between the up-counter and the tc10drb value is detected after the timer starts, the level of the ppg pin is inverted and an inttc10 interrupt request is generated. the up-counter continues counting. when a match between the up-counter and the tc10dra value is detected, the level of the ppg pin is inverted and an inttc10 interrupt request is generated. tc10cr is cleared to ?00? automatically at this time, and the timer stops. the pulse generated by ppg retains the same level as that when the timer stops. since the output level of the ppg pin can be set with tc10cr when the timer starts, a positive or negative pulse can be generated. since the inverted le vel of the timer f/f1 output level is output to the ppg pin, specify tc10cr to ?0? to set the high level to the ppg pin, and ?1? to set the low level to the ppg pin. upon reset, the timer f/f1 is initialized to ?0?. note 1: to change tc10dra or tc10drb during a run of t he timer, set a value sufficiently larger than the count value of the counter. setting a value smaller t han the count value of the counter during a run of the timer may generate a pulse di fferent from that specified. note 2: do not change tc10cr during a run of the timer. tc10cr can be set correctly only at initialization (after reset). when the timer stops during ppg, tc10cr can not be set correctly from this point onward if the ppg output has the level which is inverted of the level when the timer starts. (setting tc10cr specifies the timer f/f1 to the level inverted of the pro- grammed value.) therefore, the timer f/f1 needs to be initialized to ensure an arbitrary level of the ppg output. to initialize the timer f/f1, change tc10cr to the timer mode (it is not required to start the timer mode), and then set the ppg mode. set tc10cr at this time. note 3: in the ppg mode, the following relationship must be satisfied. tc10dra > tc10drb note 4: set tc10drb after changing the mode of tc10m to the ppg mode.
page 95 TMP86FS28FG figure 8-7 ppg output example :generating a pulse which is high-going for 800 s and low-going for 200 p s (fc = 16 mhz) setting port ld (tc10cr), 10000111b ; sets the ppg mode, selects the source clock ldw (tc10dra), 007dh ; sets the cycle (1 ms y 2 7 /fc ms = 007dh) ldw (tc10drb), 0019h ; sets the low-level pulse width (200 p s y 2 7 /fc = 0019h) ld (tc10cr), 10010111b ; starts the timer example :after stopping ppg, setting the ppg pin to a high-level to restart ppg (fc = 16 mhz) setting port ld (tc10cr), 10000111b ; sets the ppg mode, selects the source clock ldw (tc10dra), 007dh ; sets the cycle (1 ms y 2 7 /fc p s = 007dh) ldw (tc10drb), 0019h ; sets the low-level pulse width (200 p s y 2 7 /fc = 0019h) ld (tc10cr), 10010111b ; starts the timer :: ld (tc10cr), 10000111b ; stops the timer ld (tc10cr), 10000100b ; sets the timer mode ld (tc10cr), 00000111b ; sets the ppg mode, tff10 = 0 ld (tc10cr), 00010111b ; starts the timer q r d ppg pin function output port output enable i/o port output latch shared with ppg output data output toggle set clear q tc10cr write to tc10cr internal reset match to tc10drb match to tc10dra :?:?:?:?:?:?:?::::?:?:?:? tc10cr clear timer f/f10 inttc10 interrupt request
page 96 8. 16-bit timercounter (tc10,tc11) 8.1 16-bit timercounter 10 TMP86FS28FG figure 8-8 pp g mode timing chart inttc10 tc10dra internal clock counter tc10drb tc10dra ppg pin output 0 inttc10 interrupt request interrupt request 12 m01 2 n m01 n 2 n n + 1 n + 1 m (a) continuous pulse generation (tc10s = 01) tc10drb trigger count start timer start counter internal clock tc10 pin input ppg pin output 01 m n n n + 1 m 0 (b) one-shot pulse generation (tc10s = 10) match detect note: m > n note: m > n [application] one-shot pulse output
page 97 TMP86FS28FG 8.2 16-bit timercounter 11 8.2.1 configuration figure 8-9 timercounter 11 (tc11) :::?:w :w pin tc1 :?:w:?::? mett11 start capture clear source :w :w clock ppg output mode write to tc11cr 16-bit up-counter clear tc11drb selector tc11dra tc11cr tc11 control register match inttc11 interript tff11 acap11 tc11ck window mode set t oggl e q 2 t oggl e set clear q y a d b c s b a y s tc11s clear mppg11 ppg output mode internal reset s enable mcap11 s y a b tc11s 2 set clear command start decoder external trigger start edge detector note: function i/o ma y not operate dependin g on i/o port settin g . for more details, see the chapter "i/o port". port (note) q pulse width measurement mode falling rising trigger external cmp 16-bit timer register a, b pulse width measurement mode port (note) fc/2 11, fs/2 3 fc/2 7 fc/2 3
page 98 8. 16-bit timercounter (tc10,tc11) 8.2 16-bit timercounter 11 TMP86FS28FG 8.2.2 timercounter control the timercounter 11 is controlled by the timercounte r 11 control register (tc11cr) and two 16-bit timer registers (tc11dra and tc11drb). note 1: fc: high-frequency clock [hz], fs: low-frequency clock [hz] note 2: the timer register consists of two shift registers. a va lue set in the timer register becomes valid at the rising edge o f the first source clock pulse that occurs after the upper byte (t c11drah and tc11drbh) is written. therefore, write the lower timer register 1514131211109876543210 tc11dra (0021h, 0020h) tc11drah (0021h) tc11dral (0020h) (initial value: 1111 1111 1111 1111) read/write tc11drb (0023h, 0022h) tc11drbh (0023h) tc11drbl (0022h) (initial value: 1111 1111 1111 1111) read/write (write e nabled only in the ppg output mode) timercounter 11 control register tc11cr (0024h) 7 6 543210 tff11 acap11 mcap11 mett11 mppg11 tc11s tc11ck tc11m read/write (initial value: 0000 0000) tff11 timer f/f11 control 0: clear 1: set r/w acap11 auto capture control 0:auto-capture disable 1:auto-capture enable r/w mcap11 pulse width measure- ment mode control 0:double edge capture 1:single edge capture mett11 external trigger timer mode control 0:trigger start 1:trigger start and stop mppg11 ppg output control 0:continuous pulse generation 1:one-shot tc11s tc11 start control timer extrig- ger event win- dow pulse ppg r/w 00: stop and counter clear oooooo 01: command start o????o 10: rising edge start (ex-trigger/pulse/ppg) rising edge count (event) positive logic count (window) ? ooooo 11: falling edge start (ex-trigger/pulse/ppg) falling edge count (event) negative logic count (window) ? ooooo tc11ck tc11 source clock select [hz] normal1/2, idle1/2 mode divider slow, sleep mode r/w dv7ck = 0 dv7ck = 1 00 fc/2 11 fs/2 3 dv9 fs/2 3 01 fc/2 7 fc/2 7 dv5 ? 10 fc/2 3 fc/2 3 dv1 ? 11 external clock (tc11 pin input) tc11m tc11 operating mode select 00: timer/external trigger timer/event counter mode 01: window mode 10: pulse width measurement mode 11: ppg (programmable pulse generate) output mode r/w
page 99 TMP86FS28FG byte and the upper byte in this order (it is recommended to write the register with a 16-bit acce ss instruction). writing only the lower byte (tc11dral and tc11drbl) does not enable the setting of the timer register. note 3: to set the mode, source clock, ppg output control and timer f/f control, write to tc11cr1 during tc11s=00. set the timer f/f10 control until the first ti mer start after setting the ppg mode. note 4: auto-capture can be used only in t he timer, event counter, and window modes. note 5: to set the timer registers, the following relationship must be satisfied. tc11dra > tc11drb > 1 (ppg output mode), tc11dra > 1 (other modes) note 6: set tff11 to ?0? in the mode except ppg output mode. note 7: set tc11drb after setting tc11m to the ppg output mode. note 8: when the stop mode is entered, the start control (tc11s) is cleared to ?00? automatically, and the timer stops. after th e stop mode is exited, set the tc 11s to use the timer counter again. note 9: use the auto-capture function in the operative condition of tc11. a captured value may not be fixed if it's read after t he execution of the timer stop or auto-capture disable. read the capture value in a capture enabled condition. note 10:since the up-counter value is captured into tc11drb by the source clock of up-counter after setting tc11cr to "1". therefore, to read the captured value, wait at leas t one cycle of the internal source clock before reading tc11drb for the first time. 8.2.3 function timercounter 11 has six types of operating modes: time r, external trigger timer, event counter, window, pulse width measurement, programmable pulse generator output modes. 8.2.3.1 timer mode in the timer mode, the up-counter counts up using the internal clock. when a match between the up-counter and the timer register 1a (tc11dra) value is detected, an inttc11 interr upt is generated and the up-counter is cleared. after being cleared, the up-counter restarts counting. setting tc11cr to ?1? captures the up-counter value into the timer register 1b (tc11drb) with the auto-cap ture function. use the auto-capture function in the operative condition of tc11. a captured value may not be fixed if it's read after the execution of the timer stop or auto-captu re disable. read the capture value in a capture enabled condition. since the up-counter value is captured into tc11drb by the source clock of up- counter after setting tc11cr to "1". therefore, to read the captured value, wait at least one cycle of the internal source clock before reading tc11drb for the first time. table 8-3 internal source clock for timercounter 11 (example: fc 16 mhz, fs 32.768 khz) tc11ck normal1/2, idle1/2 mode slow, sleep mode dv7ck = 0 dv7ck = 1 resolution [ p s] maximum time setting [s] resolution [ p s] maximum time setting [s] resolution [ p s] maximum time set- ting [s] 00 128 8.39 244.14 16.0 244.14 16.0 01 8.0 0.524 8.0 0.524 ? ? 10 0.5 32.77 m 0.5 32.77 m ? ?
page 100 8. 16-bit timercounter (tc10,tc11) 8.2 16-bit timercounter 11 TMP86FS28FG note: since the up-counter value is captured into tc11drb by the source clock of up-counter after setting tc11cr to "1". therefore, to read the captured value, wait at least one cycle of the internal source clock before reading tc11drb for the first time. figure 8-10 timer mode timing chart example 1 :setting the timer mode with source clock fc/2 11 [hz] and generating an interrupt 1 second later (fc 16 mhz, tbtcr ?0?) ldw (tc11dra), 1e84h ; sets the timer register (1 s y 2 11 /fc 1e84h) di ; imf ?0? set (eirl). 2 ; enables inttc11 ei ; imf ?1? ld (tc11cr), 00000000b ; selects the source clock and mode ld (tc11cr), 00010000b ; starts tc11 example 2 :auto-capture ld (tc11cr), 01010000b ; acap11 m 1 :: ld wa, (tc11drb) ; reads the capture value match detect acap11 tc11drb tc11dra inttc11 interruput request source clock counter source clock counter ? (a) timer mode (b) auto-capture ? 7 6 345 0 timer start 12 3 2 1 4 0 counter clear capture n + 1 n n n m + 2 m + 1 m m capture m + 2 m + 1 n + 1 n m - 1 m - 1 m - 2 n - 1 n - 1 n - 1
page 101 TMP86FS28FG 8.2.3.2 external trigger timer mode in the external trigger timer mode, the up-counter starts counting by the input pulse triggering of the tc11 pin, and counts up at the edge of the internal clock. for the trigger edge used to start counting, either the rising or falling edge is defined in tc11cr. ? when tc11cr is set to ?1? (trigger start and stop) when a match between the up-counter and the tc11dra value is detected after the timer starts, the up-counter is cleared and halted and an inttc11 interrupt request is generated. if the edge opposite to trigger edge is de tected before detecting a match between the up- counter and the tc11dra, the up-counter is clear ed and halted without generating an interrupt request. therefore, this mode can be used to detect exceeding the specified pulse by interrupt. after being halted, the up-counter restarts counting when the trigge r edge is detected. ? when tc11cr is set to ?0? (trigger start) when a match between the up-counter and the tc11dra value is detected after the timer starts, the up-counter is cleared and halted and an inttc11 interrupt request is generated. the edge opposite to the trigger edge has no ef fect in count up. the tr igger edge for the next counting is ignored if detecting it before de tecting a match between the up-counter and the tc11dra. since the tc11 pin input has the noise rejection, pulses of 4/fc [s] or less are rejected as noise. a pulse width of 12/fc [s] or more is required to ensure edge detection. the rejection ci rcuit is turned off in the slow1/2 or sleep1/2 mode, but a pulse width of one machine cycle or more is required. example 1 :generating an interrupt 1 ms after the rising edge of the input pulse to the tc11 pin (fc =16 mhz) ldw (tc11dra), 007dh ; 1ms y 2 7 /fc 7dh di ; imf ?0? set (eirl). 2 ; enables inttc11 interrupt ei ; imf ?1? ld (tc11cr), 00000100b ; selects the source clock and mode ld (tc11cr), 00100100b ; starts tc11 external trigger, mett11 0 example 2 :generating an interrupt when the low-level pulse with 4 ms or more width is input to the tc11 pin (fc =16 mhz) ldw (tc11dra), 01f4h ; 4 ms y 2 7 /fc 1f4h di ; imf ?0? set (eirl). 2 ; enables inttc11 interrupt ei ; imf ?1? ld (tc11cr), 00000100b ; selects the source clock and mode ld (tc11cr), 01110100b ; starts tc11 external trigger, mett11 0
page 102 8. 16-bit timercounter (tc10,tc11) 8.2 16-bit timercounter 11 TMP86FS28FG figure 8-11 external tr igger timer mode timing chart inttc11 interrupt request source clock up-counter tc11dra tc11 pin input inttc11 interrupt request source clock up-counter tc11dra tc11 pin input 0 at the rising edge (tc11s = 10) at the rising edge (tc11s = 10) (a) trigger start (mett11 = 0) count start match detect count start 01234 23 n (b) trigger start and stop (mett11 = 1) count start count start 0 123 m 0 n n 0 count clear note: m < n count clear 123 1 n m - 1 n - 1 match detect count clear
page 103 TMP86FS28FG 8.2.3.3 event counter mode in the event counter mode, the up-counter counts up at the edge of the input pulse to the tc11 pin. either the rising or falling edge of the input pulse is selected as the count up edge in tc11cr. when a match between the up-count er and the tc11dra value is de tected, an inttc11 interrupt is generated and the up-counter is clear ed. after being cleared, the up-coun ter restarts coun ting at each edge of the input pulse to the tc11 pin. since a match between the up-counter and the value set to tc11dra is detected at the edge opposite to the selected e dge, an inttc11 interrupt request is generated after a match of the value at the edge opposite to the selected edge. two or more machine cycles are required for the low-or high-level pulse input to the tc11 pin. setting tc11cr to ?1? captures the up-co unter value into tc11d rb with the auto capture function. use the auto-capture func tion in the operative condition of tc11. a captured value may not be fixed if it's read after the execution of the timer stop or auto-capture di sable. read the capture value in a capture enabled condition. since the up-counter valu e is captured into tc11 drb by the source clock of up-counter after setting tc11cr to "1". ther efore, to read the captu red value, wait at least one cycle of the internal source clock be fore reading tc11drb for the first time. figure 8-12 event counter mode timing chart table 8-4 input pulse width to tc11 pin minimum pulse width [s] normal1/2, idle1/2 mode slow1/2, sleep1/2 mode high-going 2 3 /fc 2 3 /fs low-going 2 3 /fc 2 3 /fs at the rising edge (tc11s = 10) inttc11 interrput request tc11 pin input up-counter tc11dra ? 2 1 0 n timer start 2 1 0 n match detect counter clear n - 1
page 104 8. 16-bit timercounter (tc10,tc11) 8.2 16-bit timercounter 11 TMP86FS28FG 8.2.3.4 window mode in the window mode, the up-counter counts up at the rising edge of the pulse that is logical anded product of the input pulse to the tc11 pin (window pulse) and the internal source clock. either the posi- tive logic (count up during high-going pulse) or ne gative logic (count up during low-going pulse) can be selected. when a match between the up-count er and the tc11dra value is de tected, an inttc11 interrupt is generated and the up-counter is cleared. define the window pulse to the frequency which is sufficiently lower than the internal source clock pro- grammed with tc11cr. figure 8-13 window mode timing chart match detect tc11dra inttc11 interrput request interrput request internal clock counter tc11dra tc11 pin input internal clock counter tc11 pin input inttc11 (a) positive logic (tc11s = 10) (b) negative logic (tc11s = 11) ? ? match detect 1 0 7 47 5 46 31 2 1 0 7 5 3 6 2 0 2 3 counter clear timer start 890 1 9 timer start counter clear count start count stop count start count start count stop count start
page 105 TMP86FS28FG 8.2.3.5 pulse width measurement mode in the pulse width measurement mode, the up-counter st arts counting by the input pulse triggering of the tc11 pin, and counts up at the edge of the internal clock. either the rising or falling edge of the internal clock is selected as the trigger edge in tc11cr< tc11s>. either the single- or double-edge capture is selected as the trigger edge in tc11cr. ? when tc11cr is set to ?1? (single-edge capture) either high- or low-level inpu t pulse width can be measured. to measure the high-level input pulse width, set the rising edge to tc11cr. to measure the low-level input pulse width, set the falling edge to tc11cr. when detecting the edge opposite to the trigger edge used to start counting after the timer starts, the up-counter captures the up-counter value into tc11drb and generates an inttc11 interrupt request. the up-counter is cleared at th is time, and then restar ts counting when detect- ing the trigger edge used to start counting. ? when tc11cr is set to ?0? (double-edge capture) the cycle starting with either the high- or low-going input pulse can be measured. to mea- sure the cycle starting with the high-going pulse, set the rising edge to tc11cr. to measure the cycle startin g with the low-going pulse, set the falling edge to tc11cr. when detecting the edge opposite to the trigger edge used to start counting after the timer starts, the up-counter captures the up-counter value into tc11drb and generates an inttc11 interrupt request. the up-counter continues co unting up, and captures the up-counter value into tc11drb and generates an inttc11 interrupt request when detecting the trigger edge used to start counting. the up-counter is cleared at this time, and then continues counting. note 1: the captured value must be read from tc11drb unt il the next trigger edge is detected. if not read, the captured value becomes a don?t care. it is recomm ended to use a 16-bit access instruction to read the captured value from tc11drb. note 2: for the single-edge capture, the counter after ca pturing the value stops at ?1? until detecting the next edge. therefore, the second captured value is ?1? larger than the captured value immediately after counting starts. note 3: the first captured value after the timer starts may be read incorrectively, therefore, ignore the first captured value.
page 106 8. 16-bit timercounter (tc10,tc11) 8.2 16-bit timercounter 11 TMP86FS28FG example :duty measurem ent (resolution fc/2 7 [hz]) clr (inttc11sw). 0 ; inttc11 service switch initial setting address set to convert inttc11sw at each inttc11 ld (tc11cr), 00000110b ; sets the tc11 mode and source clock di ; imf ?0? set (eirh). 7 ; enables inttc11 ei ; imf ?1? ld (tc11cr), 00100110b ; starts tc11 with an external trigger at mcap11 = 0 : pinttc11: cpl (inttc11sw). 0 ; inttc11 interrupt, inverts and tests inttc11 service switch jrs f, sinttc11 ld a, (tc11drbl) ; reads tc11drb (high-level pulse width) ld w,(tc11drbh) ld (hpulse), wa ; stores high-level pulse width in ram reti sinttc11: ld a, (tc11drbl) ; reads tc11drb (cycle) ld w,(tc11drbh) ld (width), wa ; stores cycle in ram : reti ; duty calculation : vinttc11: dw pinttc11 ; inttc11 interrupt vector width hpulse tc11 pin inttc11 interrupt request inttc11sw
page 107 TMP86FS28FG figure 8-14 pulse width measurement mode tc11drb inttc11 interrupt request interrupt request tc11 pin input counter internal clock (mcap11 = "1") 23 n count start count start trigger (tc11s = "10") 1 3 2 1 4 0 n 0 capture n - 1 tc11drb inttc11 tc11 pin input counter internal clock (mcap11 = "0") 12 n count start count start (tc11s = "10") 3 2 1 4 0 n capture capture n + 1 m - 2 n + 3 n + 2 n + 1 m - 1 m0 m [application] high-or low-level pulse width measurement [application] (1) cycle/frequency measurement (2) duty measurement (a) single-edge capture (b) double-edge capture
page 108 8. 16-bit timercounter (tc10,tc11) 8.2 16-bit timercounter 11 TMP86FS28FG 8.2.3.6 programmable pulse generate (ppg) output mode in the programmable pulse generation (ppg) mode, an arbitrary duty pulse is generated by counting performed in the internal clock. to start the timer, tc11cr specifies eith er the edge of the input pulse to the tc11 pin or the command start. tc11 cr specifies whether a duty pulse is pro- duced continuously or not (one-shot pulse). ? when tc11cr is set to ?0? (continuous pulse generation) when a match between the up-counter and the tc11drb value is detected after the timer starts, the level of the ppg pin is inverted and an inttc11 interrupt request is generated. the up-counter continues counting. when a match between the up-counter and the tc11dra value is detected, the level of the ppg pin is inverted and an inttc1 1 interrupt request is generated. the up-counter is cleared at this time, and then continues counting and pulse generation. when tc11s is cleared to ?0 0? during ppg output, the ppg pin retains the level immediately before the counter stops. ? when tc11cr is set to ?1? (one-shot pulse generation) when a match between the up-counter and the tc11drb value is detected after the timer starts, the level of the ppg pin is inverted and an inttc11 interrupt request is generated. the up-counter continues counting. when a match between the up-counter and the tc11dra value is detected, the level of the ppg pin is inverted and an inttc1 1 interrupt request is generated. tc11cr is cleared to ?00? automatically at this time, and the timer stops. the pulse generated by ppg retains the same level as that when the timer stops. since the output level of the ppg pin can be set with tc11cr when the timer starts, a positive or negative pulse can be generated. since the inverted le vel of the timer f/f1 output level is output to the ppg pin, specify tc11cr to ?0? to set the high level to the ppg pin, and ?1? to set the low level to the ppg pin. upon reset, the timer f/f1 is initialized to ?0?. note 1: to change tc11dra or tc11drb during a run of the timer, set a value sufficiently larger than the count value of the counter. setting a value smaller t han the count value of the counter during a run of the timer may generate a pulse di fferent from that specified. note 2: do not change tc11cr during a run of the timer. tc11cr can be set correctly only at initialization (after reset). when the timer stops during ppg, tc11cr can not be set cor- rectly from this point onward if the ppg output has the level which is inverted of the level when the timer starts. (setting tc11cr specifies the timer f/f1 to the level inverted of the pro- grammed value.) therefore, the timer f/f1 needs to be initialized to ensure an arbitrary level of the ppg output. to initialize the timer f/f1, change tc11cr to the timer mode (it is not required to start the timer mode), and then set the ppg mode. set tc11cr at this time. note 3: in the ppg mode, the following relationship must be satisfied. tc11dra > tc11drb note 4: set tc11drb after changing the mode of tc11m to the ppg mode.
page 109 TMP86FS28FG figure 8-15 ppg output example :generating a pulse which is high-going for 800 s and low-going for 200 p s (fc = 16 mhz) setting port ld (tc11cr), 10000111b ; sets the ppg mode, selects the source clock ldw (tc11dra), 007dh ; sets the cycle (1 ms y 2 7 /fc ms = 007dh) ldw (tc11drb), 0019h ; sets the low-level pulse width (200 p s y 2 7 /fc = 0019h) ld (tc11cr), 10010111b ; starts the timer example :after stopping ppg, setting the ppg pin to a high-level to restart ppg (fc = 16 mhz) setting port ld (tc11cr), 10000111b ; sets the ppg mode, selects the source clock ldw (tc11dra), 007dh ; sets the cycle (1 ms y 2 7 /fc p s = 007dh) ldw (tc11drb), 0019h ; sets the low-level pulse width (200 p s y 2 7 /fc = 0019h) ld (tc11cr), 10010111b ; starts the timer :: ld (tc11cr), 10000111b ; stops the timer ld (tc11cr), 10000100b ; sets the timer mode ld (tc11cr), 00000111b ; sets the ppg mode, tff11 = 0 ld (tc11cr), 00010111b ; starts the timer q r d ppg pin function output port output enable i/o port output latch shared with ppg output data output toggle set clear q tc11cr write to tc11cr internal reset match to tc11drb match to tc11dra :?:?:?:?:?:?:?::::?:?:?:? tc11cr clear timer f/f11 inttc11 interrupt request
page 110 8. 16-bit timercounter (tc10,tc11) 8.2 16-bit timercounter 11 TMP86FS28FG figure 8-16 ppg mo de timing chart inttc11 tc11dra internal clock counter tc11drb tc11dra ppg pin output 0 inttc11 interrupt request interrupt request 12 m01 2 n m01 n 2 n n + 1 n + 1 m (a) continuous pulse generation (tc11s = 01) tc11drb trigger count start timer start counter internal clock tc11 pin input ppg pin output 01 m n nn + 1 m 0 (b) one-shot pulse generation (tc11s = 10) match detect note: m > n note: m > n [application] one-shot pulse output
page 111 TMP86FS28FG 9. 8-bit timercounter (tc3, tc4) 9.1 configuration figure 9-1 8-bit timercounter 3, 4 8-bit up-counter decode en a y b s a b y c d e f g h s a y b s s a y b toggle q set clear 8-bit up-counter a b y c d e f g h s decode en toggle q set clear pwm mode pdo, ppg mode pdo mode pwm, ppg mode pwm mode pwm mode 16-bit mode 16-bit mode 16-bit mode 16-bit mode timer, event counter mode overflow overflow timer, event couter mode 16-bit mode clear clear fc/2 7 fc/2 5 fc/2 3 fc/2 fc fc/2 7 fc/2 5 fc/2 3 fc/2 fc pdo, pwm, ppg mode pdo, pwm mode 16-bit mode fc/2 11 or fs/2 3 fc/2 11 or fs/2 3 fs fs tc4cr tc3cr ttreg4 pwreg4 ttreg3 pwreg3 tc3 pin tc4 pin tc4s tc3s inttc3 interrupt request inttc4 interrupt request tff4 tff3 pdo 4/pwm 4/ ppg 4 pin pdo 3/pwm 3/ pin tc3ck tc4ck tc3m tc3s tff3 tc4m tc4s tff4 timer f/f4 timer f/f3
page 112 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86FS28FG 9.2 timercounter control the timercounter 3 is controlled by the timercounter 3 control register (tc3cr) and two 8-bit timer registers (ttreg3, pwreg3). note 1: do not change the timer register (t treg3) setting while the timer is running. note 2: do not change the timer register (pwreg3) setting in the operating mode except the 8-bit and 16-bit pwm modes while the timer is running. note 1: fc: high-frequency clock [hz] fs: low-frequency clock[hz] note 2: do not change the tc3m, tc3ck and tff3 settings while the timer is running. note 3: to stop the timer operation (tc3s= 1 o 0), do not change the tc3m, tc3ck and tff3 settings. to start the timer opera- tion (tc3s= 0 o 1), tc3m, tc3ck and tff3 can be programmed. note 4: to use the timercounter in the 16-bit mode, set th e operating mode by programming tc4cr, where tc3m must be fixed to 011. note 5: to use the timercounter in the 16-bit mode, select the source clock by programming tc3ck. set the timer start control and timer f/f control by programming tc4 cr and tc4cr, respectively. note 6: the operating clock settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9-1 and table 9-2. timercounter 3 timer register ttreg3 (0015h) r/w 76543210 (initial value: 1111 1111) pwreg3 (0019h) r/w 76543210 (initial value: 1111 1111) timercounter 3 control register tc3cr (0009h) 76543210 tff3 tc3ck tc3s tc3m (initial value: 0000 0000) tff3 time f/f3 control 0: 1: clear set r/w tc3ck operating clock selection [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 11 fs/2 3 fs/2 3 001 fc/2 7 fc/2 7 ? 010 fc/2 5 fc/2 5 ? 011 fc/2 3 fc/2 3 ? 100 fs fs fs 101 fc/2 fc/2 ? 110 fc fc fc (note 8) 111 tc3 pin input tc3s tc3 start control 0: 1: operation stop and counter clear operation start r/w tc3m tc3m operating mode select 000: 001: 010: 011: 1**: 8-bit timer/event counter mode 8-bit programmable divider output (pdo) mode 8-bit pulse width modulation (pwm) output mode 16-bit mode (each mode is selectable with tc4m.) reserved r/w
page 113 TMP86FS28FG note 7: the timer register settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9- 3. note 8: the operating clock fc in t he slow or sleep mode can be used only as the high-frequency warm-up mode.
page 114 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86FS28FG the timercounter 4 is controlled by the timercounter 4 control register (tc4cr) and two 8-bit timer registers (ttreg4 and pwreg4). note 1: do not change the timer register (t treg4) setting while the timer is running. note 2: do not change the timer register (pwreg4) setting in the operating mode except the 8-bit and 16-bit pwm modes while the timer is running. note 1: fc: high-frequency clock [hz] fs: low-frequency clock [hz] note 2: do not change the tc4m, tc4ck and tff4 settings while the timer is running. note 3: to stop the timer operation (tc4s= 1 o 0), do not change the tc4m, tc4ck and tff4 settings. to start the timer operation (tc4s= 0 o 1), tc4m, tc4ck and tff4 can be programmed. note 4: when tc4m= 1** (upper byte in the 16-bit mode), the sour ce clock becomes the tc3 over flow signal regardless of the tc4ck setting. note 5: to use the timercounter in the 16-bit mode, select the operating mode by programming tc4m, where tc3cr must be set to 011. timercounter 4 timer register ttreg4 (0016h) r/w 76543210 (initial value: 1111 1111) pwreg4 (001ah) r/w 76543210 (initial value: 1111 1111) timercounter 4 control register tc4cr (000ah) 76543210 tff4 tc4ck tc4s tc4m (initial value: 0000 0000) tff4 timer f/f4 control 0: 1: clear set r/w tc4ck operating clock selection [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 11 fs/2 3 fs/2 3 001 fc/2 7 fc/2 7 ? 010 fc/2 5 fc/2 5 ? 011 fc/2 3 fc/2 3 ? 100 fs fs fs 101 fc/2 fc/2 ? 110 fc fc ? 111 tc4 pin input tc4s tc4 start control 0: 1: operation stop and counter clear operation start r/w tc4m tc4m operating mode select 000: 001: 010: 011: 100: 101: 110: 111: 8-bit timer/event counter mode 8-bit programmable divider output (pdo) mode 8-bit pulse width modulation (pwm) output mode reserved 16-bit timer/event counter mode warm-up counter mode 16-bit pulse width modulation (pwm) output mode 16-bit ppg mode r/w
page 115 TMP86FS28FG note 6: to the timercounter in the 16-bit mode, select the so urce clock by programming tc3cr. set the timer start control and timer f/f control by prog ramming tc4s and tff4, respectively. note 7: the operating clock settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9-1 and table 9-2. note 8: the timer register settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9- 3. note 1: for 16-bit operations (16-bit timer/event counter, warm- up counter, 16-bit pwm and 16-bit ppg), set its source clock on lower bit (tc3ck). note 2: 2 : available source clock table 9-1 operating mode and selectable source clock (normal1/2 and idle1/2 modes) operating mode fc/2 11 or fs/2 3 fc/2 7 fc/2 5 fc/2 3 fs fc/2 fc tc3 pin input tc4 pin input 8-bit timer 2222 ????? 8-bit event counter ??????? 2 2 8-bit pdo 2222 ????? 8-bit pwm 2222222 ?? 16-bit timer 2222 ????? 16-bit event counter ??????? 2 ? warm-up counter ???? 2 ???? 16-bit pwm 22222222 ? 16-bit ppg 2222 ??? 2 ? table 9-2 operating mode an d selectable source clock (slow1/2 and sleep1/2 modes) operating mode fc/2 11 or fs/2 3 fc/2 7 fc/2 5 fc/2 3 fs fc/2 fc tc3 pin input tc4 pin input 8-bit timer 2 ???????? 8-bit event counter ??????? 22 8-bit pdo 2 ???????? 8-bit pwm 2 ??? 2 ???? 16-bit timer 2 ???????? 16-bit event counter ??????? 2 ? warm-up counter ?????? 2 ?? 16-bit pwm 2 ??? 2 ?? 2 ? 16-bit ppg 2 ?????? 2 ? note1: note2: for 16-bit operations (16-bit timer/event counter, warm-up counter, 16-bit pwm and 16-bit ppg), set its source clock on lower bit (tc3ck). 2 : available source clock
page 116 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86FS28FG note: n = 3 to 4 table 9-3 constraints on register values being compared operating mode register value 8-bit timer/event counter 1 d (ttregn) d 255 8-bit pdo 1 d (ttregn) d 255 8-bit pwm 2 d (pwregn) d 254 16-bit timer/event counter 1 d (ttreg4, 3) d 65535 warm-up counter 256 d (ttreg4, 3) d 65535 16-bit pwm 2 d (pwreg4, 3) d 65534 16-bit ppg 1 d (pwreg4, 3) < (ttreg4, 3) d 65535 and (pwreg4, 3) + 1 < (ttreg4, 3)
page 117 TMP86FS28FG 9.3 function the timercounter 3 and 4 have the 8-bit timer, 8-bit ev ent counter, 8-bit programmable divider output (pdo), 8- bit pulse width modulation (pwm) output modes. the time rcounter 3 and 4 (tc3, 4) are cascadable to form a 16- bit timer. the 16-bit timer has the operat ing modes such as the 16-bit timer, 16-bit event counter, warm-up counter, 16-bit pulse width modulation (pwm) output and 16-bit programmable pulse generation (ppg) modes. 9.3.1 8-bit timer mode (tc3 and 4) in the timer mode, the up-counter counts up using the internal clock. when a match between the up-counter and the timer register j (ttregj) value is detected, an inttcj interrupt is generated and the up-counter is cleared. after being cl eared, the up-counter restarts counting. note 1: in the timer mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj and ppgj pins may output pulses. note 2: in the timer mode, do not change the ttregj setting while the timer is running. si nce ttregj is not in the shift register configuration in the timer mode, the new value programmed in ttregj is in effect immediately after the programming. therefore, if ttregi is changed while the timer is r unning, an expected operation may not be obtained. note 3: j = 3, 4 table 9-4 source clock for timercounter 3, 4 (internal clock) source clock resolution maximum time setting normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 [hz] fs/2 3 [hz] fs/2 3 [hz] 128 p s244.14 p s 32.6 ms 62.3 ms fc/2 7 fc/2 7 ?8 p s ? 2.0 ms ? fc/2 5 fc/2 5 ?2 p s ? 510 p s? fc/2 3 fc/2 3 ? 500 ns ? 127.5 p s? example :setting the timer mode with source clock fc/2 7 hz and generating an interrupt 80 p s later (timercounter4, fc = 16.0 mhz) ld (ttreg4), 0ah : sets the timer register (80 p s y 2 7 /fc = 0ah). di set (eire). 5 : enables inttc4 interrupt. ei ld (tc4cr), 00010000b : sets the operating clock to fc/2 7 , and 8-bit timer mode. ld (tc4cr), 00011000b : starts tc4.
page 118 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86FS28FG figure 9-2 8-bit timer mode timing chart (tc4) 9.3.2 8-bit event counter mode (tc3, 4) in the 8-bit event counter mode, the up-counter counts up at the falling edge of the input pulse to the tcj pin. when a match between the up-counter and the ttregj valu e is detected, an inttcj interrupt is generated and the up-counter is cleared. after being cleared, the up-counter restarts counti ng at the falling edge of the input pulse to the tcj pin. two machine cycles are required for the low- or high-level pulse input to the tcj pin. therefore, a maximum freque ncy to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 hz in the slow1/2 or sleep1/2 mode. note 1: in the event counter mode, fix tcjcr to 0. if not fixed, the pdoj, pwmj and ppgj pins may output pulses. note 2: in the event counter mode, do not change the ttre gj setting while the timer is running. since ttregj is not in the shift register configuration in the event counter mode, the new value programmed in ttregj is in effect immediately after the programming. therefore, if ttregi is changed whil e the timer is running, an expected operation may not be obtained. note 3: j = 3, 4 figure 9-3 8-bit event count er mode timing chart (tc4) 9.3.3 8-bit programmable divi der output (pdo) mode (tc3, 4) this mode is used to generate a pu lse with a 50% duty cycle from the pdoj pin. in the pdo mode, the up-counter counts up using the internal clock. when a match between the up-counter and the ttregj value is detected , the logic level output from the pdoj pin is switched to the opposite state and the up-counter is cleared. the inttcj interrupt request is generated at the time. the logic state opposite to the timer f/fj logic level is output from the pdoj pin. an arbitrary value can be set to the timer f/fj by tcjcr. upon reset, the timer f/fj value is initialized to 0. to use the programmable divider output, set the output latch of the i/o port to 1. 1 2 3 n-1 n 0 1 n-1 n 2 0 1 2 0 n ? internal source clock counter match detect counter clear match detect counter clear tc4cr ttreg4 inttc4 interrupt request 1 0 2 n-1 n 0 1 2 0 n ? counter match detect counter clear n-1 n 2 0 1 match detect counter clear tc4cr ttreg4 inttc4 interrupt request tc4 pin input
page 119 TMP86FS28FG note 1: in the programmable divider output mode, do not change the ttregj setting while the timer is running. since ttregj is not in the shift register configur ation in the programmable divider output mode, the new value programmed in ttregj is in effect immediatel y after programming. therefore, if ttregi is changed while the timer is running, an ex pected operation may not be obtained. note 2: when the timer is stopped during pdo output, the pdoj pin holds the output status when the timer is stopped. to change the output status, program tcjcr after the timer is stopped. do not change the tcjcr setting upon stopping of the timer. example: fixing the pdoj pin to the high level when the timercounter is stopped clr (tcjcr).3: stops the timer. clr (tcjcr).7: sets the pdoj pin to the high level. note 3: j = 3, 4 example :generating 1024 hz pulse using tc4 (fc = 16.0 mhz) setting port ld (ttreg4), 3dh : 1/1024 y 2 7 /fc y 2 = 3dh ld (tc4cr), 00010001b : sets the operating clock to fc/2 7 , and 8-bit pdo mode. ld (tc4cr), 00011001b : starts tc4.
page 120 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86FS28FG figure 9-4 8-bit pdo mode timing chart (tc4) 12 0 n 0 n 0 n 0 n 0 1 2 2 1 2 1 2 3 1 0 n ? internal source clock counter match detect match detect match detect match detect held at the level when the timer is stopped set f/f write of "1" tc4cr tc4cr ttreg4 timer f/f4 pdo 4 pin inttc4 interrupt request
page 121 TMP86FS28FG 9.3.4 8-bit pulse wi dth modulation (pwm) output mode (tc3, 4) this mode is used to generate a pulse-width modulated (pwm) signals with up to 8 bits of resolution. the up-counter counts up using the internal clock. when a match between the up-counter and the pwregj value is detected, the logic level output from the timer f/fj is switched to the opposite state. the counter continues counting. the logic level output from the timer f/fj is switched to the opposite state again by the up-co unter overflow, and the counter is cleared. the inttcj interrupt request is generated at this time. since the initial value can be set to the timer f/fj by tcjcr, positive and negative pulses can be gen- erated. upon reset, the tim er f/fj is cleared to 0. (the logic level output from the pwmj pin is the opposite to the timer f/fj logic level.) since pwregj in the pwm mode is se rially connected to the shift regist er, the value set to pwregj can be changed while the timer is running. the value set to pwregj during a run of the timer is shifted by the inttcj interrupt request and loaded into pwregj. while the timer is stopped, the value is shifted immedi- ately after the programming of pwre gj. if executing the read instruction to pwregj during pwm output, the value in the shift register is read, but not the valu e set in pwregj. therefore, after writing to pwregj, the reading data of pwregj is previo us value until inttcj is generated. for the pin used for pwm output, the output latch of the i/o port must be set to 1. note 1: in the pwm mode, program the timer register pw regj immediately after the inttcj interrupt request is generated (normally in the inttcj interrupt service r outine.) if the programming of pwregj and the inter- rupt request occur at the same time, an unstable value is shifted, that may result in generation of the pulse different from the programmed value until the next inttcj interrupt request is generated. note 2: when the timer is stopped during pwm output, the pwmj pin holds the output status when the timer is stopped. to change the output status, program tcjcr after the timer is stopped. do not change the tcjcr upon stopping of the timer. example: fixing the pwmj pin to the high level when the timercounter is stopped clr (tcjcr).3: stops the timer. clr (tcjcr).7: sets the pwmj pin to the high level. note 3: to enter the stop mode during pwm output, stop the timer and then enter the stop mode. if the stop mode is entered without stopping the timer when fc, fc/2 or fs is selected as the source clock, a pulse is out- put from the pwmj pin during the warm-up period time after exiting the stop mode. note 4: j = 3, 4 table 9-5 pwm output mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 [hz] fs/2 3 [hz] fs/2 3 [hz] 128 p s244.14 p s 32.8 ms 62.5 ms fc/2 7 fc/2 7 ?8 p s?2.05 ms? fc/2 5 fc/2 5 ?2 p s ? 512 p s? fc/2 3 fc/2 3 ? 500 ns ? 128 p s? fs fs fs 30.5 p s30.5 p s 7.81 ms 7.81 ms fc/2 fc/2 ? 125 ns ? 32 p s? fc fc ? 62.5 ns ? 16 p s?
page 122 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86FS28FG figure 9-5 8-bit pwm mo de timing chart (tc4) 1 0 nn+1 ff 0 n n+1 ff 0 1 m m+1 ff 0 1 1 p n ? internal source clock counter m p m p n ? shift registar shift shift shift shift match detect match detect one cycle period match detect match detect n m p n tc4cr tc4cr pwreg4 timer f/f4 pwm 4 pin inttc4 interrupt request write to pwreg4 write to pwreg4
page 123 TMP86FS28FG 9.3.5 16-bit timer mode (tc3 and 4) in the timer mode, the up-counter counts up using the internal clock. the timercounter 3 and 4 are cascad- able to form a 16-bit timer. when a match between the up-counter and the timer regi ster (ttreg3, ttreg4) valu e is detected after the timer is started by setting tc4cr to 1, an inttc 4 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter continues counting. pr ogram the lower byte and upper byte in this order in the timer register. (programming only the uppe r or lower byte should not be attempted.) note 1: in the timer mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj , and ppgj pins may output a pulse. note 2: in the timer mode, do not change the ttregj setting while the timer is running. si nce ttregj is not in the shift register configuration in the timer mode, the new value programmed in ttregj is in effect immediately after programming of ttregj. therefore, if ttreg j is changed while the time r is running, an expected operation may not be obtained. note 3: j = 3, 4 figure 9-6 16-bit timer m ode timing chart (tc3 and tc4) table 9-6 source clock for 16-bit timer mode source clock resolution maximum time setting normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 fs/2 3 fs/2 3 128 p s244.14 p s 8.39 s 16 s fc/2 7 fc/2 7 ?8 p s ? 524.3 ms ? fc/2 5 fc/2 5 ?2 p s ? 131.1 ms ? fc/2 3 fc/2 3 ? 500 ns ? 32.8 ms ? example :setting the timer mode with source clock fc/2 7 hz, and generating an interrupt 300 ms later (fc = 16.0 mhz) ldw (ttreg3), 927ch : sets the timer register (300 ms y 2 7 /fc = 927ch). di set (eire). 5 : enables inttc4 interrupt. ei ld (tc3cr), 13h :sets the operating clock to fc/2 7 , and 16-bit timer mode (lower byte). ld (tc4cr), 04h : sets the 16-bit timer mode (upper byte). ld (tc4cr), 0ch : starts the timer. 1 0 2 3 mn-1 mn 0 1 mn-1 mn 2 0 1 2 0 n ? m ? internal source clock counter match detect counter clear match detect counter clear tc4cr ttreg3 (lower byte) inttc4 interrupt request ttreg4 (upper byte)
page 124 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86FS28FG 9.3.6 16-bit event c ounter mode (tc3 and 4) 9.3.7 16-bit pulse width modulatio n (pwm) output mode (tc3 and 4) this mode is used to generate a pulse-width modulated (pwm) signals with up to 16 bits of resolution. the timercounter 3 and 4 are cascadable to form the 16-bit pwm signal generator. the counter counts up using the internal clock or external clock. when a match between the up-counter and the timer register (pwreg3, pwreg4) value is detected, the logic level output from the timer f/f4 is switched to the opposite state. the counter continues counting. the logic level output from the timer f/f4 is switched to the opposite state again by the counter overflow, and the counter is cleared. the inttc4 interrupt is generated at this time. two machine cycles are required for the high- or low-level pulse input to the tc3 pin. therefore, a maxi- mum frequency to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 to in the slow1/2 or sleep1/2 mode. since the initial value can be set to the timer f/f4 by tc4cr, positive and negative pulses can be generated. upon reset, the timer f/f4 is cleared to 0. (the logic level output from the pwm 4 pin is the opposite to the timer f/f4 logic level.) since pwreg4 and 3 in the pwm mode are serially connected to the shift register, the values set to pwreg4 and 3 can be changed while the timer is runni ng. the values set to pwreg4 and 3 during a run of the timer are shifted by the inttcj interrupt request and loaded into pwreg4 and 3. while the timer is stopped, the values are shifted i mmediately after the programming of pwreg4 and 3. set the lower byte (pwreg3) and upper byte (pwreg4) in this order to program pwreg4 and 3. (programming only the lower or upper byte of the register should not be attempted.) if executing the read instruction to pwreg4 and 3 during pwm output, the values set in the shift register is read, but not the values set in pwreg4 and 3. therefore, after writing to the pwreg4 and 3, reading data of pwreg4 and 3 is previous value until inttc4 is generated. for the pin used for pwm output, the output latch of the i/o port must be set to 1. note 1: in the pwm mode, program the timer register pwreg4 and 3 immediately after the inttc4 interrupt request is generated (normally in the inttc4 interrupt service routine.) if the programming of pwregj and the interrupt request occur at the same time, an unstable value is shifted, that may result in generation of pulse different from the programmed value until the next inttc4 interrupt request is generated. note 2: when the timer is stopped during pwm output, the pwm 4 pin holds the output status when the timer is stopped. to change the output status, program tc4cr after the timer is stopped. do not program tc4cr upon stopping of the timer. example: fixing the pwm 4 pin to the high level when the timercounter is stopped in the event counter mode, the up-counter counts up at the falling edge to the tc3 pin. the timercounter 3 and 4 are cascadable to fo rm a 16-bit event counter. when a match between the up-counter and the timer register (ttreg3, ttreg4) value is detected after the timer is started by setting tc4cr to 1, an inttc4 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter rest arts counting at the falling edge of the input pulse to the tc3 pin. two machine cycles are required for the low- or high-level pulse input to the tc3 pin. therefore, a maximum freque ncy to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/ 2 4 in the slow1/2 or sleep1/2 mode. program the lo wer byte (ttreg3), and upper byte (ttreg4) in this order in the timer register. (programming only the upper or lower byte should not be attempted.) note 1: note 2: note 3: in the event counter mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj and ppgj pins may output pulses. in the event counter mode, do not change the ttregj setti ng while the timer is running. since ttregj is not in the shift register configuration in the event counter mode, the new value programmed in ttregj is in effect imme- diately after the programming. therefore, if ttregj is changed while the timer is running, an expected operation may not be obtained. j = 3, 4
page 125 TMP86FS28FG clr (tc4cr).3: stops the timer. clr (tc4cr).7 : sets the pwm 4 pin to the high level. note 3: to enter the stop mode, stop the timer and then enter the stop mode. if the stop mode is entered with- out stopping of the timer when fc, fc/2 or fs is select ed as the source clock, a pulse is output from the pwm 4 pin during the warm-up period time after exiting the stop mode. table 9-7 16-bit pwm output mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 fs/2 3 [hz] fs/2 3 [hz] 128 p s244.14 p s 8.39 s 16 s fc/2 7 fc/2 7 ?8 p s ? 524.3 ms ? fc/2 5 fc/2 5 ?2 p s ? 131.1 ms ? fc/2 3 fc/2 3 ? 500 ns ? 32.8 ms ? fs fs fs 30.5 p s30.5 p s2 s 2 s fc/2 fc/2 ? 125 ns ? 8.2 ms ? fc fc ? 62.5 ns ? 4.1 ms ? example :generating a pulse with 1-ms high-level width and a period of 32.768 ms (fc = 16.0 mhz) setting ports ldw (pwreg3), 07d0h : sets the pulse width. ld (tc3cr), 33h : sets the operating clock to fc/2 3 , and 16-bit pwm output mode (lower byte). ld (tc4cr), 056h : sets tff4 to the initial value 0, and 16-bit pwm signal generation mode (upper byte). ld (tc4cr), 05eh : starts the timer.
page 126 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86FS28FG figure 9-7 16-bit pwm m ode timing chart (tc3 and tc4) 1 0 an an+1 ffff 0 an an+1 ffff 0 1 bm bm+1 ffff 0 bm cp b c 1 1 cp n a an ? ? ? internal source clock 16-bit shift register shift shift shift shift counter match detect match detect one cycle period match detect match detect an bm cp an m p tc4cr tc4cr pwreg3 (lower byte) timer f/f4 pwm 4 pin inttc4 interrupt request pwreg4 (upper byte) write to pwreg4 write to pwreg4 write to pwreg3 write to pwreg3
page 127 TMP86FS28FG 9.3.8 16-bit programmable pulse generate (ppg) ou tput mode (tc3 and 4) this mode is used to generate pulses with up to 16- bits of resolution. the timer counter 3 and 4 are cascad- able to enter the 16-bit ppg mode. the counter counts up using the inte rnal clock or external clock. when a match between the up-counter and the timer register (pwreg3, pwreg4 ) value is detected, the logic level output from the timer f/f4 is switched to the opposite state. the counter continues counting. the logic level output from the timer f/f4 is switched to the opposite state again when a match betw een the up-counter and th e timer register (ttreg3, ttreg4) value is detected, and the counter is cleared. the inttc4 interrupt is generated at this time. since the initial value can be set to the timer f/f4 by tc4cr, positive and negative pulses can be generated. upon reset, the timer f/f4 is cleared to 0. (the logic level output from the ppg 4 pin is the opposite to the timer f/f4.) set the lower byte and upper byte in this order to program the timer register. (ttreg3 o ttreg4, pwreg3 o pwreg4) (programming only the upper or lower byte should not be attempted.) for ppg output, set the output latch of the i/o port to 1. note 1: in the ppg mode, do not change the pwregi and ttregi settings while the timer is running. since pwregi and ttregi are not in the shift register c onfiguration in the ppg mode, the new values pro- grammed in pwregi and ttregi are in effect immediately after progra mming pwregi and ttregi. therefore, if pwregi and ttregi are changed whil e the timer is running, an expected operation may not be obtained. note 2: when the timer is stopped during ppg output, the ppg 4 pin holds the output status when the timer is stopped. to change the output status, program tc4cr after the timer is stopped. do not change tc4cr upon stopping of the timer. example: fixing the ppg 4 pin to the high level when the timercounter is stopped clr (tc4cr).3: stops the timer clr (tc4cr).7: sets the ppg 4 pin to the high level note 3: i = 3, 4 two machine cycles are required for the high- or low- level pulse input to the tc3 pin. therefore, a maxi- mum frequency to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 to in the slow1/ 2 or sleep1/2 mode. example :generating a pulse with 1-ms high-level width and a period of 16.385 ms (fc = 16.0 mhz) setting ports ldw (pwreg3), 07d0h : sets the pulse width. ldw (ttreg3), 8002h : sets the cycle period. ld (tc3cr), 33h : sets the operating clock to fc/2 3 , and16-bit ppg mode (lower byte). ld (tc4cr), 057h : sets tff4 to the initial value 0, and 16-bit ppg mode (upper byte). ld (tc4cr), 05fh : starts the timer.
page 128 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86FS28FG figure 9-8 16-bit ppg mode timing chart (tc3 and tc4) 1 0 mn mn+1 qr-1 mn qr-1 1 mn mn+1 mn+1 0 qr 0 qr 1 0 internal source clock counter write of "0" match detect match detect match detect mn mn mn match detect match detect ? n m ? ? r q ? held at the level when the timer stops f/f clear tc4cr tc4cr pwreg3 (lower byte) timer f/f4 ppg 4 pin inttc4 interrupt request pwreg4 (upper byte) ttreg3 (lower byte) ttreg4 (upper byte)
page 129 TMP86FS28FG 9.3.9 warm-up counter mode in this mode, the warm-up period time is obtained to assure oscillation stability when the system clocking is switched between the high-frequency and low-frequency. the timer counter 3 and 4 are cascadable to form a 16-bit timercounter. the warm-up counter mode has two types of mode; switching from the high-frequency to low-frequency, and vice-versa. note 1: in the warm-up counter mode, fi x tcicr to 0. if not fixed, the pdoi , pwmi and ppgi pins may output pulses. note 2: in the warm-up counter mode, only upper 8 bits of the timer register ttreg4 and 3 are used for match detection and lower 8 bits are not used. note 3: i = 3, 4 9.3.9.1 low-frequency warm-up counter mode (normal1 o normal2 o slow2 o slow1) in this mode, the warm-up period time from a stop of the low-frequency clock fs to oscillation stability is obtained. before starting the timer, set syscr2 to 1 to oscillate the low-frequency clock. when a match between the up-counter and the timer regist er (ttreg4, 3) value is detected after the timer is started by setting tc4cr to 1, the counter is cleared by generating the inttc4 interrupt request. after stopping the timer in the inttc4 inte rrupt service routine, set syscr2 to 1 to switch the system clock from the high-frequency to low-frequency, and then clear of syscr2 to 0 to stop the high-frequency clock. table 9-8 setting time of low-frequen cy warm-up counter mode (fs = 32.768 khz) minimum time setting (ttreg4, 3 = 0100h) maximum time setting (ttreg4, 3 = ff00h) 7.81 ms 1.99 s example :after check ing low-frequency clock oscillation stability with tc4 and 3, switching to the slow1 mode set (syscr2).6 : syscr2 m 1 ld (tc3cr), 43h : sets tff3=0, source clock fs, and 16-bit mode. ld (tc4cr), 05h : sets tff4=0, and warm-up counter mode. ld (ttreg3), 8000h : sets the warm-up time. (the warm-up time depends on the oscillator characteristic.) di : imf m 0 set (eire). 5 : enables the inttc4. ei : imf m 1 set (tc4cr).3 : starts tc4 and 3. : : pinttc4: clr (tc4cr).3 : stops tc4 and 3. set (syscr2).5 : syscr2 m 1 (switches the system clock to the low-frequency clock.) clr (syscr2).7 : syscr2 m 0 (stops the high-frequency clock.) reti : : vinttc4: dw pinttc4 : inttc4 vector table
page 130 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86FS28FG 9.3.9.2 high-frequency warm-up counter mode (slow1 o slow2 o normal2 o normal1) in this mode, the warm-up period time from a stop of the high-frequency clock fc to the oscillation sta- bility is obtained. before starting the timer, set sy scr2 to 1 to oscillat e the high-frequency clock. when a match between the up-counter and the timer regist er (ttreg4, 3) value is detected after the timer is started by setting tc4cr to 1, the counter is cleared by generating the inttc4 interrupt request. after stopping the timer in the inttc4 inte rrupt service routine, clear syscr2 to 0 to switch the system clock from the low-frequency to high-frequency, and then syscr2 to 0 to stop the low-frequency clock. table 9-9 setting time in high-frequency warm-up counter mode minimum time setting (ttreg4, 3 = 0100h) maximum time setting (ttreg4, 3 = ff00h) 16 p s 4.08 ms example :after check ing high-frequency clock oscillation stability with tc4 and 3, switching to the normal1 mode set (syscr2).7 : syscr2 m 1 ld (tc3cr), 63h : sets tff3=0, source clock fc, and 16-bit mode. ld (tc4cr), 05h : sets tff4=0, and warm-up counter mode. ld (ttreg3), 0f800h : sets the warm-up time. (the warm-up time depends on the oscillator characteristic.) di : imf m 0 set (eire). 5 : enables the inttc4. ei : imf m 1 set (tc4cr).3 : starts the tc4 and 3. : : pinttc4: clr (tc4cr).3 : stops the tc4 and 3. clr (syscr2).5 : syscr2 m 0 (switches the system clock to the high-frequency clock.) clr (syscr2).6 : syscr2 m 0 (stops the low-frequency clock.) reti : : vinttc4: dw pinttc4 : inttc4 vector table
page 131 TMP86FS28FG 10. 8-bit timercounter (tc5, tc6) 10.1 configuration figure 10-1 8-bit ti mercounter 5, 6 8-bit up-counter decode en a y b s a b y c d e f g h s a y b s s a y b toggle q set clear 8-bit up-counter a b y c d e f g h s decode en toggle q set clear pwm mode pdo, ppg mode pdo mode pwm, ppg mode pwm mode pwm mode 16-bit mode 16-bit mode 16-bit mode 16-bit mode timer, event counter mode overflow overflow timer, event couter mode 16-bit mode clear clear fc/2 7 fc/2 5 fc/2 3 fc/2 fc fc/2 7 fc/2 5 fc/2 3 fc/2 fc pdo, pwm, ppg mode pdo, pwm mode 16-bit mode fc/2 11 or fs/2 3 fc/2 11 or fs/2 3 fs fs tc6cr tc5cr ttreg6 pwreg6 ttreg5 pwreg5 tc5 pin tc6 pin tc6s tc5s inttc5 interrupt request inttc6 interrupt request tff6 tff5 pdo 6/pwm 6/ ppg 6 pin pdo 5/pwm 5/ pin tc5ck tc6ck tc5m tc5s tff5 tc6m tc6s tff6 timer f/f6 timer f/f5
page 132 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86FS28FG 10.2 timercounter control the timercounter 5 is controlled by the timercounter 5 control register (tc5cr) and two 8-bit timer registers (ttreg5, pwreg5). note 1: do not change the timer register (t treg5) setting while the timer is running. note 2: do not change the timer register (pwreg5) setting in the operating mode except the 8-bit and 16-bit pwm modes while the timer is running. note 1: fc: high-frequency clock [hz] fs: low-frequency clock[hz] note 2: do not change the tc5m, tc5ck and tff5 settings while the timer is running. note 3: to stop the timer operation (tc5s= 1 o 0), do not change the tc5m, tc5ck and tff5 settings. to start the timer opera- tion (tc5s= 0 o 1), tc5m, tc5ck and tff5 can be programmed. note 4: to use the timercounter in the 16-bit mode, set th e operating mode by programming tc6cr, where tc5m must be fixed to 011. note 5: to use the timercounter in the 16-bit mode, select the source clock by programming tc5ck. set the timer start control and timer f/f control by programming tc6 cr and tc6cr, respectively. note 6: the operating clock settings are limited depending on the timer operating mode. for the detailed descriptions, see table 10-1 and table 10-2. timercounter 5 timer register ttreg5 (0017h) r/w 76543210 (initial value: 1111 1111) pwreg5 (001bh) r/w 76543210 (initial value: 1111 1111) timercounter 5 control register tc5cr (000bh) 76543210 tff5 tc5ck tc5s tc5m (initial value: 0000 0000) tff5 time f/f5 control 0: 1: clear set r/w tc5ck operating clock selection [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 11 fs/2 3 fs/2 3 001 fc/2 7 fc/2 7 ? 010 fc/2 5 fc/2 5 ? 011 fc/2 3 fc/2 3 ? 100 fs fs fs 101 fc/2 fc/2 ? 110 fc fc fc (note 8) 111 tc5 pin input tc5s tc5 start control 0: 1: operation stop and counter clear operation start r/w tc5m tc5m operating mode select 000: 001: 010: 011: 1**: 8-bit timer/event counter mode 8-bit programmable divider output (pdo) mode 8-bit pulse width modulation (pwm) output mode 16-bit mode (each mode is selectable with tc6m.) reserved r/w
page 133 TMP86FS28FG note 7: the timer register settings are limited depending on t he timer operating mode. for the detailed descriptions, see table 10- 3. note 8: the operating clock fc in t he slow or sleep mode can be used only as the high-frequency warm-up mode.
page 134 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86FS28FG the timercounter 6 is controlled by the timercounter 6 control register (tc6cr) and two 8-bit timer registers (ttreg6 and pwreg6). note 1: do not change the timer register (t treg6) setting while the timer is running. note 2: do not change the timer register (pwreg6) setting in the operating mode except the 8-bit and 16-bit pwm modes while the timer is running. note 1: fc: high-frequency clock [hz] fs: low-frequency clock [hz] note 2: do not change the tc6m, tc6ck and tff6 settings while the timer is running. note 3: to stop the timer operation (tc6s= 1 o 0), do not change the tc6m, tc6ck and tff6 settings. to start the timer operation (tc6s= 0 o 1), tc6m, tc6ck and tff6 can be programmed. note 4: when tc6m= 1** (upper byte in the 16-bit mode), the sour ce clock becomes the tc5 over flow signal regardless of the tc6ck setting. note 5: to use the timercounter in the 16-bit mode, select the operating mode by programming tc6m, where tc5cr must be set to 011. timercounter 6 timer register ttreg6 (0018h) r/w 76543210 (initial value: 1111 1111) pwreg6 (001ch) r/w 76543210 (initial value: 1111 1111) timercounter 6 control register tc6cr (000ch) 76543210 tff6 tc6ck tc6s tc6m (initial value: 0000 0000) tff6 timer f/f6 control 0: 1: clear set r/w tc6ck operating clock selection [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 11 fs/2 3 fs/2 3 001 fc/2 7 fc/2 7 ? 010 fc/2 5 fc/2 5 ? 011 fc/2 3 fc/2 3 ? 100 fs fs fs 101 fc/2 fc/2 ? 110 fc fc ? 111 tc6 pin input tc6s tc6 start control 0: 1: operation stop and counter clear operation start r/w tc6m tc6m operating mode select 000: 001: 010: 011: 100: 101: 110: 111: 8-bit timer/event counter mode 8-bit programmable divider output (pdo) mode 8-bit pulse width modulation (pwm) output mode reserved 16-bit timer/event counter mode warm-up counter mode 16-bit pulse width modulation (pwm) output mode 16-bit ppg mode r/w
page 135 TMP86FS28FG note 6: to the timercounter in the 16-bit mode, select the so urce clock by programming tc5cr. set the timer start control and timer f/f control by prog ramming tc6s and tff6, respectively. note 7: the operating clock settings are limited depending on the timer operating mode. for the detailed descriptions, see table 10-1 and table 10-2. note 8: the timer register settings are limited depending on t he timer operating mode. for the detailed descriptions, see table 10- 3. note 1: for 16-bit operations (16-bit timer/event counter, warm- up counter, 16-bit pwm and 16-bit ppg), set its source clock on lower bit (tc5ck). note 2: 2 : available source clock table 10-1 operating mode and selectable source clock (normal1/2 and idle1/2 modes) operating mode fc/2 11 or fs/2 3 fc/2 7 fc/2 5 fc/2 3 fs fc/2 fc tc5 pin input tc6 pin input 8-bit timer 2222 ????? 8-bit event counter ??????? 2 2 8-bit pdo 2222 ????? 8-bit pwm 2222222 ?? 16-bit timer 2222 ????? 16-bit event counter ??????? 2 ? warm-up counter ???? 2 ???? 16-bit pwm 22222222 ? 16-bit ppg 2222 ??? 2 ? table 10-2 operating mode an d selectable source clock (slow1/2 and sleep1/2 modes) operating mode fc/2 11 or fs/2 3 fc/2 7 fc/2 5 fc/2 3 fs fc/2 fc tc5 pin input tc6 pin input 8-bit timer 2 ???????? 8-bit event counter ??????? 22 8-bit pdo 2 ???????? 8-bit pwm 2 ??? 2 ???? 16-bit timer 2 ???????? 16-bit event counter ??????? 2 ? warm-up counter ?????? 2 ?? 16-bit pwm 2 ??? 2 ?? 2 ? 16-bit ppg 2 ?????? 2 ? note1: note2: for 16-bit operations (16-bit timer/event counter, warm-up counter, 16-bit pwm and 16-bit ppg), set its source clock on lower bit (tc5ck). 2 : available source clock
page 136 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86FS28FG note: n = 5 to 6 table 10-3 constraints on register values being compared operating mode register value 8-bit timer/event counter 1 d (ttregn) d 255 8-bit pdo 1 d (ttregn) d 255 8-bit pwm 2 d (pwregn) d 254 16-bit timer/event counter 1 d (ttreg6, 5) d 65535 warm-up counter 256 d (ttreg6, 5) d 65535 16-bit pwm 2 d (pwreg6, 5) d 65534 16-bit ppg 1 d (pwreg6, 5) < (ttreg6, 5) d 65535 and (pwreg6, 5) + 1 < (ttreg6, 5)
page 137 TMP86FS28FG 10.3 function the timercounter 5 and 6 have the 8-bit timer, 8-bit ev ent counter, 8-bit programmable divider output (pdo), 8- bit pulse width modulation (pwm) output modes. the time rcounter 5 and 6 (tc5, 6) are cascadable to form a 16- bit timer. the 16-bit timer has the operat ing modes such as the 16-bit timer, 16-bit event counter, warm-up counter, 16-bit pulse width modulation (pwm) output and 16-bit programmable pulse generation (ppg) modes. 10.3.1 8-bit timer mode (tc5 and 6) in the timer mode, the up-counter counts up using the internal clock. when a match between the up-counter and the timer register j (ttregj) value is detected, an inttcj interrupt is generated and the up-counter is cleared. after being cl eared, the up-counter restarts counting. note 1: in the timer mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj and ppgj pins may output pulses. note 2: in the timer mode, do not change the ttregj setting while the timer is running. si nce ttregj is not in the shift register configuration in the timer mode, the new value programmed in ttregj is in effect immediately after the programming. therefore, if ttregi is changed while the timer is r unning, an expected operation may not be obtained. note 3: j = 5, 6 table 10-4 source clock for timercounter 5, 6 (internal clock) source clock resolution maximum time setting normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 [hz] fs/2 3 [hz] fs/2 3 [hz] 128 p s244.14 p s 32.6 ms 62.3 ms fc/2 7 fc/2 7 ?8 p s ? 2.0 ms ? fc/2 5 fc/2 5 ?2 p s ? 510 p s? fc/2 3 fc/2 3 ? 500 ns ? 127.5 p s? example :setting the timer mode with source clock fc/2 7 hz and generating an interrupt 80 p s later (timercounter6, fc = 16.0 mhz) ld (ttreg6), 0ah : sets the timer register (80 p s y 2 7 /fc = 0ah). di set (eird). 0 : enables inttc6 interrupt. ei ld (tc6cr), 00010000b : sets the operating clock to fc/2 7 , and 8-bit timer mode. ld (tc6cr), 00011000b : starts tc6.
page 138 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86FS28FG figure 10-2 8-bit timer mode timing chart (tc6) 10.3.2 8-bit event counter mode (tc5, 6) in the 8-bit event counter mode, the up-counter counts up at the falling edge of the input pulse to the tcj pin. when a match between the up-counter and the ttregj valu e is detected, an inttcj interrupt is generated and the up-counter is cleared. after being cleared, the up-counter restarts counti ng at the falling edge of the input pulse to the tcj pin. two machine cycles are required for the low- or high-level pulse input to the tcj pin. therefore, a maximum freque ncy to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 hz in the slow1/2 or sleep1/2 mode. note 1: in the event counter mode, fix tcjcr to 0. if not fixed, the pdoj, pwmj and ppgj pins may output pulses. note 2: in the event counter mode, do not change the ttre gj setting while the timer is running. since ttregj is not in the shift register configuration in the event counter mode, the new value programmed in ttregj is in effect immediately after the programming. therefore, if ttregi is changed whil e the timer is running, an expected operation may not be obtained. note 3: j = 5, 6 figure 10-3 8-bit event counter mode ti ming chart (tc6) 10.3.3 8-bit programmable divi der output (pdo) mode (tc5, 6) this mode is used to generate a pu lse with a 50% duty cycle from the pdoj pin. in the pdo mode, the up-counter counts up using the internal clock. when a match between the up-counter and the ttregj value is detected , the logic level output from the pdoj pin is switched to the opposite state and the up-counter is cleared. the inttcj interrupt request is generated at the time. the logic state opposite to the timer f/fj logic level is output from the pdoj pin. an arbitrary value can be set to the timer f/fj by tcjcr. upon reset, the timer f/fj value is initialized to 0. to use the programmable divider output, set the output latch of the i/o port to 1. 1 2 3 n-1 n 0 1 n-1 n 2 0 1 2 0 n ? internal source clock counter match detect counter clear match detect counter clear tc6cr ttreg6 inttc6 interrupt request 1 0 2 n-1 n 0 1 2 0 n ? counter match detect counter clear n-1 n 2 0 1 match detect counter clear tc6cr ttreg6 inttc6 interrupt request tc6 pin input
page 139 TMP86FS28FG note 1: in the programmable divider output mode, do not change the ttregj setting while the timer is running. since ttregj is not in the shift register configur ation in the programmable divider output mode, the new value programmed in ttregj is in effect immediatel y after programming. therefore, if ttregi is changed while the timer is running, an ex pected operation may not be obtained. note 2: when the timer is stopped during pdo output, the pdoj pin holds the output status when the timer is stopped. to change the output status, program tcjcr after the timer is stopped. do not change the tcjcr setting upon stopping of the timer. example: fixing the pdoj pin to the high level when the timercounter is stopped clr (tcjcr).3: stops the timer. clr (tcjcr).7: sets the pdoj pin to the high level. note 3: j = 5, 6 example :generating 1024 hz pulse using tc6 (fc = 16.0 mhz) setting port ld (ttreg6), 3dh : 1/1024 y 2 7 /fc y 2 = 3dh ld (tc6cr), 00010001b : sets the operating clock to fc/2 7 , and 8-bit pdo mode. ld (tc6cr), 00011001b : starts tc6.
page 140 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86FS28FG figure 10-4 8-bi t pdo mode timing chart (tc6) 12 0 n 0 n 0 n 0 n 0 1 2 2 1 2 1 2 3 1 0 n ? internal source clock counter match detect match detect match detect match detect held at the level when the timer is stopped set f/f write of "1" tc6cr tc6cr ttreg6 timer f/f6 pdo 6 pin inttc6 interrupt request
page 141 TMP86FS28FG 10.3.4 8-bit pulse width modulat ion (pwm) output mode (tc5, 6) this mode is used to generate a pulse-width modulated (pwm) signals with up to 8 bits of resolution. the up-counter counts up using the internal clock. when a match between the up-counter and the pwregj value is detected, the logic level output from the timer f/fj is switched to the opposite state. the counter continues counting. the logic level output from the timer f/fj is switched to the opposite state again by the up-co unter overflow, and the counter is cleared. the inttcj interrupt request is generated at this time. since the initial value can be set to the timer f/fj by tcjcr, positive and negative pulses can be gen- erated. upon reset, the tim er f/fj is cleared to 0. (the logic level output from the pwmj pin is the opposite to the timer f/fj logic level.) since pwregj in the pwm mode is se rially connected to the shift regist er, the value set to pwregj can be changed while the timer is running. the value set to pwregj during a run of the timer is shifted by the inttcj interrupt request and loaded into pwregj. while the timer is stopped, the value is shifted immedi- ately after the programming of pwre gj. if executing the read instruction to pwregj during pwm output, the value in the shift register is read, but not the valu e set in pwregj. therefore, after writing to pwregj, the reading data of pwregj is previo us value until inttcj is generated. for the pin used for pwm output, the output latch of the i/o port must be set to 1. note 1: in the pwm mode, program the timer register pw regj immediately after the inttcj interrupt request is generated (normally in the inttcj interrupt service r outine.) if the programming of pwregj and the inter- rupt request occur at the same time, an unstable value is shifted, that may result in generation of the pulse different from the programmed value until the next inttcj interrupt request is generated. note 2: when the timer is stopped during pwm output, the pwmj pin holds the output status when the timer is stopped. to change the output status, program tcjcr after the timer is stopped. do not change the tcjcr upon stopping of the timer. example: fixing the pwmj pin to the high level when the timercounter is stopped clr (tcjcr).3: stops the timer. clr (tcjcr).7: sets the pwmj pin to the high level. note 3: to enter the stop mode during pwm output, stop the timer and then enter the stop mode. if the stop mode is entered without stopping the timer when fc, fc/2 or fs is selected as the source clock, a pulse is out- put from the pwmj pin during the warm-up period time after exiting the stop mode. note 4: j = 5, 6 table 10-5 pwm output mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 [hz] fs/2 3 [hz] fs/2 3 [hz] 128 p s244.14 p s 32.8 ms 62.5 ms fc/2 7 fc/2 7 ?8 p s?2.05 ms? fc/2 5 fc/2 5 ?2 p s ? 512 p s? fc/2 3 fc/2 3 ? 500 ns ? 128 p s? fs fs fs 30.5 p s30.5 p s 7.81 ms 7.81 ms fc/2 fc/2 ? 125 ns ? 32 p s? fc fc ? 62.5 ns ? 16 p s?
page 142 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86FS28FG figure 10-5 8-bit pwm mode timing chart (tc6) 1 0 nn+1 ff 0 n n+1 ff 0 1 m m+1 ff 0 1 1 p n ? internal source clock counter m p m p n ? shift registar shift shift shift shift match detect match detect one cycle period match detect match detect n m p n tc6cr tc6cr pwreg6 timer f/f6 pwm 6 pin inttc6 interrupt request write to pwreg6 write to pwreg6
page 143 TMP86FS28FG 10.3.5 16-bit time r mode (tc5 and 6) in the timer mode, the up-counter counts up using the internal clock. the timercounter 5 and 6 are cascad- able to form a 16-bit timer. when a match between the up-counter and the timer regi ster (ttreg5, ttreg6) valu e is detected after the timer is started by setting tc6cr to 1, an inttc 6 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter continues counting. pr ogram the lower byte and upper byte in this order in the timer register. (programming only the uppe r or lower byte should not be attempted.) note 1: in the timer mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj , and ppgj pins may output a pulse. note 2: in the timer mode, do not change the ttregj setting while the timer is running. si nce ttregj is not in the shift register configuration in the timer mode, the new value programmed in ttregj is in effect immediately after programming of ttregj. therefore, if ttreg j is changed while the time r is running, an expected operation may not be obtained. note 3: j = 5, 6 figure 10-6 16-bit timer m ode timing chart (tc5 and tc6) table 10-6 source clock for 16-bit timer mode source clock resolution maximum time setting normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 fs/2 3 fs/2 3 128 p s244.14 p s 8.39 s 16 s fc/2 7 fc/2 7 ?8 p s ? 524.3 ms ? fc/2 5 fc/2 5 ?2 p s ? 131.1 ms ? fc/2 3 fc/2 3 ? 500 ns ? 32.8 ms ? example :setting the timer mode with source clock fc/2 7 hz, and generating an interrupt 300 ms later (fc = 16.0 mhz) ldw (ttreg5), 927ch : sets the timer register (300 ms y 2 7 /fc = 927ch). di set (eird). 0 : enables inttc6 interrupt. ei ld (tc5cr), 13h :sets the operating clock to fc/2 7 , and 16-bit timer mode (lower byte). ld (tc6cr), 04h : sets the 16-bit timer mode (upper byte). ld (tc6cr), 0ch : starts the timer. 1 0 2 3 mn-1 mn 0 1 mn-1 mn 2 0 1 2 0 n ? m ? internal source clock counter match detect counter clear match detect counter clear tc6cr ttreg5 (lower byte) inttc6 interrupt request ttreg6 (upper byte)
page 144 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86FS28FG 10.3.6 16-bit event c ounter mode (tc5 and 6) 10.3.7 16-bit pulse wi dth modulation (pwm) ou tput mode (tc5 and 6) this mode is used to generate a pulse-width modulated (pwm) signals with up to 16 bits of resolution. the timercounter 5 and 6 are cascadable to form the 16-bit pwm signal generator. the counter counts up using the internal clock or external clock. when a match between the up-counter and the timer register (pwreg5, pwreg6) value is detected, the logic level output from the timer f/f6 is switched to the opposite state. the counter continues counting. the logic level output from the timer f/f6 is switched to the opposite state again by the counter overflow, and the counter is cleared. the inttc6 interrupt is generated at this time. two machine cycles are required for the high- or low-level pulse input to the tc5 pin. therefore, a maxi- mum frequency to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 to in the slow1/2 or sleep1/2 mode. since the initial value can be set to the timer f/f6 by tc6cr, positive and negative pulses can be generated. upon reset, the timer f/f6 is cleared to 0. (the logic level output from the pwm 6 pin is the opposite to the timer f/f6 logic level.) since pwreg6 and 5 in the pwm mode are serially connected to the shift register, the values set to pwreg6 and 5 can be changed while the timer is runni ng. the values set to pwreg6 and 5 during a run of the timer are shifted by the inttcj interrupt request and loaded into pwreg6 and 5. while the timer is stopped, the values are shifted i mmediately after the programming of pwreg6 and 5. set the lower byte (pwreg5) and upper byte (pwreg6) in this order to program pwreg6 and 5. (programming only the lower or upper byte of the register should not be attempted.) if executing the read instruction to pwreg6 and 5 during pwm output, the values set in the shift register is read, but not the values set in pwreg6 and 5. therefore, after writing to the pwreg6 and 5, reading data of pwreg6 and 5 is previous value until inttc6 is generated. for the pin used for pwm output, the output latch of the i/o port must be set to 1. note 1: in the pwm mode, program the timer register pwreg6 and 5 immediately after the inttc6 interrupt request is generated (normally in the inttc6 interrupt service routine.) if the programming of pwregj and the interrupt request occur at the same time, an unstable value is shifted, that may result in generation of pulse different from the programmed value until the next inttc6 interrupt request is generated. note 2: when the timer is stopped during pwm output, the pwm 6 pin holds the output status when the timer is stopped. to change the output status, program tc6cr after the timer is stopped. do not program tc6cr upon stopping of the timer. example: fixing the pwm 6 pin to the high level when the timercounter is stopped in the event counter mode, the up-counter counts up at the falling edge to the tc5 pin. the timercounter 5 and 6 are cascadable to fo rm a 16-bit event counter. when a match between the up-counter and the timer register (ttreg5, ttreg6) value is detected after the timer is started by setting tc6cr to 1, an inttc6 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter rest arts counting at the falling edge of the input pulse to the tc5 pin. two machine cycles are required for the low- or high-level pulse input to the tc5 pin. therefore, a maximum freque ncy to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/ 2 4 in the slow1/2 or sleep1/2 mode. program the lo wer byte (ttreg5), and upper byte (ttreg6) in this order in the timer register. (programming only the upper or lower byte should not be attempted.) note 1: note 2: note 3: in the event counter mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj and ppgj pins may output pulses. in the event counter mode, do not change the ttregj setti ng while the timer is running. since ttregj is not in the shift register configuration in the event counter mode, the new value programmed in ttregj is in effect imme- diately after the programming. therefore, if ttregj is changed while the timer is running, an expected operation may not be obtained. j = 5, 6
page 145 TMP86FS28FG clr (tc6cr).3: stops the timer. clr (tc6cr).7 : sets the pwm 6 pin to the high level. note 3: to enter the stop mode, stop the timer and then enter the stop mode. if the stop mode is entered with- out stopping of the timer when fc, fc/2 or fs is select ed as the source clock, a pulse is output from the pwm 6 pin during the warm-up period time after exiting the stop mode. table 10-7 16-bit pwm output mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 fs/2 3 [hz] fs/2 3 [hz] 128 p s244.14 p s 8.39 s 16 s fc/2 7 fc/2 7 ?8 p s ? 524.3 ms ? fc/2 5 fc/2 5 ?2 p s ? 131.1 ms ? fc/2 3 fc/2 3 ? 500 ns ? 32.8 ms ? fs fs fs 30.5 p s30.5 p s2 s 2 s fc/2 fc/2 ? 125 ns ? 8.2 ms ? fc fc ? 62.5 ns ? 4.1 ms ? example :generating a pulse with 1-ms high-level width and a period of 32.768 ms (fc = 16.0 mhz) setting ports ldw (pwreg5), 07d0h : sets the pulse width. ld (tc5cr), 33h : sets the operating clock to fc/2 3 , and 16-bit pwm output mode (lower byte). ld (tc6cr), 056h : sets tff6 to the initial value 0, and 16-bit pwm signal generation mode (upper byte). ld (tc6cr), 05eh : starts the timer.
page 146 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86FS28FG figure 10-7 16-bit pwm mode timing chart (tc5 and tc6) 1 0 an an+1 ffff 0 an an+1 ffff 0 1 bm bm+1 ffff 0 bm cp b c 1 1 cp n a an ? ? ? internal source clock 16-bit shift register shift shift shift shift counter match detect match detect one cycle period match detect match detect an bm cp an m p tc6cr tc6cr pwreg5 (lower byte) timer f/f6 pwm 6 pin inttc6 interrupt request pwreg6 (upper byte) write to pwreg6 write to pwreg6 write to pwreg5 write to pwreg5
page 147 TMP86FS28FG 10.3.8 16-bit programmable pulse generate (ppg) ou tput mode (tc5 and 6) this mode is used to generate pulses with up to 16- bits of resolution. the timer counter 5 and 6 are cascad- able to enter the 16-bit ppg mode. the counter counts up using the inte rnal clock or external clock. when a match between the up-counter and the timer register (pwreg5, pwreg6 ) value is detected, the logic level output from the timer f/f6 is switched to the opposite state. the counter continues counting. the logic level output from the timer f/f6 is switched to the opposite state again when a match betw een the up-counter and th e timer register (ttreg5, ttreg6) value is detected, and the counter is cleared. the inttc6 interrupt is generated at this time. since the initial value can be set to the timer f/f6 by tc6cr, positive and negative pulses can be generated. upon reset, the timer f/f6 is cleared to 0. (the logic level output from the ppg 6 pin is the opposite to the timer f/f6.) set the lower byte and upper byte in this order to program the timer register. (ttreg5 o ttreg6, pwreg5 o pwreg6) (programming only the upper or lower byte should not be attempted.) for ppg output, set the output latch of the i/o port to 1. note 1: in the ppg mode, do not change the pwregi and ttregi settings while the timer is running. since pwregi and ttregi are not in the shift register c onfiguration in the ppg mode, the new values pro- grammed in pwregi and ttregi are in effect immediately after progra mming pwregi and ttregi. therefore, if pwregi and ttregi are changed whil e the timer is running, an expected operation may not be obtained. note 2: when the timer is stopped during ppg output, the ppg 6 pin holds the output status when the timer is stopped. to change the output status, program tc6cr after the timer is stopped. do not change tc6cr upon stopping of the timer. example: fixing the ppg 6 pin to the high level when the timercounter is stopped clr (tc6cr).3: stops the timer clr (tc6cr).7: sets the ppg 6 pin to the high level note 3: i = 5, 6 two machine cycles are required for the high- or low- level pulse input to the tc5 pin. therefore, a maxi- mum frequency to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 to in the slow1/ 2 or sleep1/2 mode. example :generating a pulse with 1-ms high-level width and a period of 16.385 ms (fc = 16.0 mhz) setting ports ldw (pwreg5), 07d0h : sets the pulse width. ldw (ttreg5), 8002h : sets the cycle period. ld (tc5cr), 33h : sets the operating clock to fc/2 3 , and16-bit ppg mode (lower byte). ld (tc6cr), 057h : sets tff6 to the initial value 0, and 16-bit ppg mode (upper byte). ld (tc6cr), 05fh : starts the timer.
page 148 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86FS28FG figure 10-8 16-bit ppg mode timing chart (tc5 and tc6) 1 0 mn mn+1 qr-1 mn qr-1 1 mn mn+1 mn+1 0 qr 0 qr 1 0 internal source clock counter write of "0" match detect match detect match detect mn mn mn match detect match detect ? n m ? ? r q ? held at the level when the timer stops f/f clear tc6cr tc6cr pwreg5 (lower byte) timer f/f6 ppg 6 pin inttc6 interrupt request pwreg6 (upper byte) ttreg5 (lower byte) ttreg6 (upper byte)
page 149 TMP86FS28FG 10.3.9 warm-up counter mode in this mode, the warm-up period time is obtained to assure oscillation stability when the system clocking is switched between the high-frequency and low-frequency. the timer counter 5 and 6 are cascadable to form a 16-bit timercounter. the warm-up counter mode has two types of mode; switching from the high-frequency to low-frequency, and vice-versa. note 1: in the warm-up counter mode, fi x tcicr to 0. if not fixed, the pdoi , pwmi and ppgi pins may output pulses. note 2: in the warm-up counter mode, only upper 8 bits of the timer register ttreg6 and 5 are used for match detection and lower 8 bits are not used. note 3: i = 5, 6 10.3.9.1 low-frequency warm-up counter mode (normal1 o normal2 o slow2 o slow1) in this mode, the warm-up period time from a stop of the low-frequency clock fs to oscillation stability is obtained. before starting the timer, set syscr2 to 1 to oscillate the low-frequency clock. when a match between the up-counter and the timer regist er (ttreg6, 5) value is detected after the timer is started by setting tc6cr to 1, the counter is cleared by generating the inttc6 interrupt request. after stopping the timer in the inttc6 inte rrupt service routine, set syscr2 to 1 to switch the system clock from the high-frequency to low-frequency, and then clear of syscr2 to 0 to stop the high-frequency clock. table 10-8 setting time of low-frequency warm-up counter mode (fs = 32.768 khz) minimum time setting (ttreg6, 5 = 0100h) maximum time setting (ttreg6, 5 = ff00h) 7.81 ms 1.99 s example :after check ing low-frequency clock oscillation stability with tc6 and 5, switching to the slow1 mode set (syscr2).6 : syscr2 m 1 ld (tc5cr), 43h : sets tff5=0, source clock fs, and 16-bit mode. ld (tc6cr), 05h : sets tff6=0, and warm-up counter mode. ld (ttreg5), 8000h : sets the warm-up time. (the warm-up time depends on the oscillator characteristic.) di : imf m 0 set (eird). 0 : enables the inttc6. ei : imf m 1 set (tc6cr).3 : starts tc6 and 5. : : pinttc6: clr (tc6cr).3 : stops tc6 and 5. set (syscr2).5 : syscr2 m 1 (switches the system clock to the low-frequency clock.) clr (syscr2).7 : syscr2 m 0 (stops the high-frequency clock.) reti : : vinttc6: dw pinttc6 : inttc6 vector table
page 150 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86FS28FG 10.3.9.2 high-frequency warm-up counter mode (slow1 o slow2 o normal2 o normal1) in this mode, the warm-up period time from a stop of the high-frequency clock fc to the oscillation sta- bility is obtained. before starting the timer, set sy scr2 to 1 to oscillat e the high-frequency clock. when a match between the up-counter and the timer regist er (ttreg6, 5) value is detected after the timer is started by setting tc6cr to 1, the counter is cleared by generating the inttc6 interrupt request. after stopping the timer in the inttc6 inte rrupt service routine, clear syscr2 to 0 to switch the system clock from the low-frequency to high-frequency, and then syscr2 to 0 to stop the low-frequency clock. table 10-9 setting time in high-frequency warm-up counter mode minimum time setting (ttreg6, 5 = 0100h) maximum time setting (ttreg6, 5 = ff00h) 16 p s 4.08 ms example :after check ing high-frequency clock oscillation stability with tc6 and 5, switching to the normal1 mode set (syscr2).7 : syscr2 m 1 ld (tc5cr), 63h : sets tff5=0, source clock fc, and 16-bit mode. ld (tc6cr), 05h : sets tff6=0, and warm-up counter mode. ld (ttreg5), 0f800h : sets the warm-up time. (the warm-up time depends on the oscillator characteristic.) di : imf m 0 set (eird). 0 : enables the inttc6. ei : imf m 1 set (tc6cr).3 : starts the tc6 and 5. : : pinttc6: clr (tc6cr).3 : stops the tc6 and 5. clr (syscr2).5 : syscr2 m 0 (switches the system clock to the high-frequency clock.) clr (syscr2).6 : syscr2 m 0 (stops the low-frequency clock.) reti : : vinttc6: dw pinttc6 : inttc6 vector table
page 151 TMP86FS28FG 11. synchronous serial interface (sio) the TMP86FS28FG has a clocked-synchr onous 8-bit serial interface. serial interface has an 8-byte transmit and receive data buffer that can automatically and continuously transfer up to 64 bits of data. serial interface is connected to outside peripherl devices via so, si, sck port. 11.1 configuration figure 11-1 serial interface sio control / status register serial clock shift clock shift register 3 2 1 0 7 6 5 4 transmit and receive data buffer (8 bytes in dbr) control circuit cpu serial data output serial data input 8-bit transfer 4-bit transfer serial clock i/o buffer control circuit so si sck siocr2 siocr1 siosr intsio interrupt request
page 152 11. synchronous serial interface (sio) 11.2 control TMP86FS28FG 11.2 control the serial interface is controlled by sio control registers (s iocr1/siocr2). the serial interface status can be determined by reading sio status register (siosr). the transmit and receive data buffer is controlled by the siocr2. th e data buffer is assigned to address 0f60h to 0f67h for sio in the dbr area, and can continuously transfer up to 8 words (bytes or nibbles) at one time. when the specified number of words has b een transferred, a buffer empty (in th e transmit mode) or a buffer full (in the receive mode or tran smit/receive mode) interrupt (intsio) is generated. when the internal clock is used as the serial clock in the 8-bit receive mode and the 8-bit transmit/receive mode, a fixed interval wait can be applied to the serial clock fo r each word transferred. four different wait times can be selected with siocr2. note 1: fc; high-frequency clock [hz], fs; low-frequency clock [hz] note 2: set sios to "0" and sioinh to "1" when setting the transfer mode or serial clock. note 3: siocr1 is write-only register, whic h cannot access any of in read-modify-wri te instruction such as bit operate, etc. sio control register 1 siocr176543210 (0f68h) sios sioinh siom sck (initial value: 0000 0000) sios indicate transfer start / stop 0: stop write only 1: start sioinh continue / abort transfer 0: continuously transfer 1: abort transfer (automatically cleared after abort) siom transfer mode select 000: 8-bit transmit mode 010: 4-bit transmit mode 100: 8-bit transmit / receive mode 101: 8-bit receive mode 110: 4-bit receive mode except the above: reserved sck serial clock select normal1/2, idle1/2 mode slow1/2 sleep1/2 mode write only dv7ck = 0 dv7ck = 1 000 fc/2 13 fs/2 5 fs/2 5 001 fc/2 8 fc/2 8 - 010 fc/2 7 fc/2 7 - 011 fc/2 6 fc/2 6 - 100 fc/2 5 fc/2 5 - 101 fc/2 4 fc/2 4 - 110 reserved 111 external clock ( input from sck pin ) sio control register 2 siocr276543210 (0f69h) wait buf (initial value: ***0 0000)
page 153 TMP86FS28FG note 1: the lower 4 bits of each buffer are used during 4-bit tr ansfers. zeros (0) are stored to the upper 4bits when receiving. note 2: transmitting starts at the lowest address. received data are also stored starting from the lowest address to the highest address. ( the first buffer address transmitted is 0f60h ). note 3: the value to be loaded to buf is held after transfer is completed. note 4: siocr2 must be set when the serial interface is stopped (siof = 0). note 5: *: don't care note 6: siocr2 is write-only register, whic h cannot access any of in read-modify-wri te instruction such as bit operate, etc. note 1: t f ; frame time, t d ; data transfer time note 2: after sios is cleared to "0", siof is cleared to "0" at the termination of transfer or the setting of sioinh to "1". figure 11-2 frame time (t f ) and data transfer time (t d ) 11.3 serial clock 11.3.1 clock source internal clock or external clock for the source clock is selected by siocr1. wait wait control always sets "00" except 8-bit transmit / receive mode. write only 00: t f = t d (non wait) 01: t f = 2t d (wait) 10: t f = 4t d (wait) 11: t f = 8t d (wait) buf number of transfer words (buffer address in use) 000: 1 word transfer 0f60h 001: 2 words transfer 0f60h ~ 0f61h 010: 3 words transfer 0f60h ~ 0f62h 011: 4 words transfer 0f60h ~ 0f63h 100: 5 words transfer 0f60h ~ 0f64 h 101: 6 words transfer 0f60h ~ 0f65h 110: 7 words transfer 0f60h ~ 0f66 h 111: 8 words transfer 0f60h ~ 0f67h sio status register siosr76543210 (0f69h) siof sef siof serial transfer operating status moni- tor 0: 1: transfer terminated transfer in process read only sef shift operating status monitor 0: 1: shift operation terminated shift operation in process td tf (output) s ck output
page 154 11. synchronous serial interface (sio) 11.3 serial clock TMP86FS28FG 11.3.1.1 internal clock any of six frequencies can be selected. the serial clock is output to the outside on the sck pin. the sck pin goes high when transfer starts. when data writing (in the transmit mo de) or reading (in the receive mode or the transmit/receive mode) cannot keep up with the serial clock rate, there is a wa it function that automatically stops the serial clock and holds the next shift operation until the read/write processing is completed. note: 1 kbit = 1024 bit (fc = 16 mhz, fs = 32.768 khz) figure 11-3 automatic wait f unction (at 4-bit transmit mode) 11.3.1.2 external clock an external clock connected to the sck pin is used as the serial clock. in this case, output latch of this port should be set to "1". to ensure shifting, a pulse width of at least 4 machine cycles is required. this pulse is needed for the shift operatio n to execute certainly. actually, there is necessary processing time for interrupting, writing, and reading. the minimum pulse is determined by setting the mode and the pro- gram. therfore, maximum transfer frequenc y will be 488.3k bit/sec (at fc=16mhz). figure 11-4 external clock pulse width table 11-1 serial clock rate normal1/2, idle1/2 mode slow1/2, sleep1/2 mode dv7ck = 0 dv7ck = 1 sck clock baud rate clock baud rate clock baud rate 000 fc/2 13 1.91 kbps fs/2 5 1024 bps fs/2 5 1024 bps 001 fc/2 8 61.04 kbps fc/2 8 61.04 kbps - - 010 fc/2 7 122.07 kbps fc/2 7 122.07 kbps - - 011 fc/2 6 244.14 kbps fc/2 6 244.14 kbps - - 100 fc/2 5 488.28 kbps fc/2 5 488.28 kbps - - 101 fc/2 4 976.56 kbps fc/2 4 976.56 kbps - - 110 - - - - - - 111 external external external external external external a 1 a 2 b 0 b 1 b 2 b 3 c 0 c 1 a 3 a c b a 0 pin (output) pin (output) written transmit data a utomat i ca ll y wait function sck so t sckl t sckh tcyc = 4/fc (in the normal1/2, idle1/2 modes) 4/fs (in the slow1/2, sleep1/2 modes) t sckl , t sckh > 4tcyc sck pin (output)
page 155 TMP86FS28FG 11.3.2 shift edge the leading edge is used to transmit, a nd the trailing edge is used to receive. 11.3.2.1 leading edge transmitted data are shifted on the leading ed ge of the serial clock (falling edge of the sck pin input/ output). 11.3.2.2 trailing edge received data are shifted on the trailing edge of the serial clock (rising edge of the sck pin input/out- put). figure 11-5 shift edge 11.4 number of bits to transfer either 4-bit or 8-bit serial transfer can be selected. when 4-bit serial transfer is selected, only the lower 4 bits of the transmit/receive data buffer re gister are used. the upper 4 bits are cleared to ?0? when receiving. the data is transferred in sequence star ting at the least significant bit (lsb). 11.5 number of words to transfer up to 8 words consisting of 4 bits of data (4-bit serial tran sfer) or 8 bits (8-bit serial tr ansfer) of data can be trans- ferred continuously. the number of words to be transferred can be selected by siocr2. an intsio interrupt is generated when the specified number of words has been transferred. if the number of words is to be changed during transfer , the serial interface must be stopped before making the ch ange. the number of words can be changed during automatic-wa it operation of an internal clock. in this case, the serial interface is not required to be stopped. bit 1 bit 2 bit 3 * 321 3210 ** 32 *** 3 bit 0 shift register shift register bit 1 bit 0 bit 2 bit 3 0 *** **** 210 * 10 ** 3210 (a) leading edge (b) trailing edge * ; don?t care so pin si pin sck pin sck pin
page 156 11. synchronous serial interface (sio) 11.6 transfer mode TMP86FS28FG figure 11-6 number of words to transfer (example: 1word = 4bit) 11.6 transfer mode siocr1 is used to select the tr ansmit, receive, or tr ansmit/receive mode. 11.6.1 4-bit and 8-bit transfer modes in these modes, firstly set the sio control register to the transmit mode, and then write first transmit data (number of transfer words to be transfer red) to the data buffer registers (dbr). after the data are written, the transmission is star ted by setting siocr1 to ?1?. the data are then output sequentially to the so pin in synchronous with th e serial clock, starting with the least significant bit (lsb). as soon as the lsb has been output, the data are transferred from the data buffer register to the shift register. when the final data bit has been transferred a nd the data buffer register is empty, an intsio (buffer empty) interrupt is generated to request the next transmitted data. when the internal clock is used, the serial clock will stop and an automatic-wait will be initiated if the next transmitted data are not loaded to the data buffer regist er by the time the number of data words specified with the siocr2 has been transmitted . writing even one word of data can cels the automatic- wait; therefore, when transmitting two or more words, always write the ne xt word before transmission of the previous word is completed. note:automatic waits are also canceled by writing to a dbr not being used as a transmit data buffer register; there- fore, during sio do not use such dbr for other applicati ons. for example, when 3 words are transmitted, do not use the dbr of the remained 5 words. when an external clock is used, the data must be writte n to the data buffer register before shifting next data. thus, the transfer speed is determin ed by the maximum delay time from the generation of the interrupt request to writing of the data to the data buffer register by the interrupt service program. the transmission is ended by clearing siocr1 to ?0? or setting siocr1 to ?1? in buffer empty interrupt service program. a 1 a 2 a 3 a 0 a 1 a 2 a 3 b 0 b 1 b 2 b 3 c 0 c 1 c 2 c 3 a 0 a 1 a 0 a 2 a 3 b 0 b 1 b 2 b 3 c 0 c 1 c 2 c 3 (a) 1 word transmit (b) 3 words transmit (c) 3 words receive so pin intsio interrupt intsio interrupt intsio interrupt so pin si pin sck pin sck pin sck pin
page 157 TMP86FS28FG siocr1 is cleared, the operation will end after all bits of words are transmitted. that the transmission has ended can be determined from the status of siosr becau se siosr is cleared to ?0? when a transfer is completed. when siocr1 is set, the transmission is immediately ended and siosr is cleared to ?0?. when an external clock is used, it is also necessary to clear siocr1 to ?0? before shifting the next data; if siocr1 is not cleared before shift out, dummy data will be transmitted and the operation will end. if it is necessary to change the number of word s, siocr1 should be cleared to ?0?, then siocr2 must be rewritten after confirming that siosr has been cleared to ?0?. figure 11-7 transfer mode (example: 8bit, 1word transfer , internal clock) figure 11-8 transfer mode (example: 8bit, 1w ord transfer, external clock) a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 a 0 dbr b a clear sios write (a) write (b) sck pin (output) so pin intsio interrupt siocr1 siosr siosr siosr a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 a 0 dbr b a clear sios write (a) write (b) sck pin (input) so pin intsio interrupt siocr1 siosr siosr
page 158 11. synchronous serial interface (sio) 11.6 transfer mode TMP86FS28FG figure 11-9 transmiiied data hold time at end of transfer 11.6.2 4-bit and 8- bit receive modes after setting the control registers to the receive mode , set siocr1 to ?1? to enable receiving. the data are then transferred to the shift register via the si pin in synchronous with the serial clock. when one word of data has been received, it is tran sferred from the shift register to the data buffer register (dbr). when the number of words specified w ith the siocr2 has been received, an intsio (buffer full) interrupt is generated to request that these data be read out. the da ta are then read from the da ta buffer registers by the interrupt service program. when the internal clock is used, and the previous data are not read from the data buffer register before the next data are received, the serial cloc k will stop and an automatic-wait will be initiated until the data are read. a wait will not be initiated if even one data word has been read. note:waits are also canceled by readi ng a dbr not being used as a received data buffer register is read; therefore, during sio do not use such dbr for other applications. when an external clock is used, the shift operation is synchronized with the extern al clock; therefore, the previous data are read before the next data are transferred to the data buffer register. if the previous data have not been read, the next data will not be transferred to th e data buffer register and th e receiving of any more data will be canceled. when an external clock is used, th e maximum transfer speed is determined by the delay between the time when the interrupt request is gene rated and when the data received have been read. the receiving is ended by clearing si ocr1 to ?0? or setting sio cr1 to ?1? in buffer full interrupt service program. when siocr1 is cleared, th e current data are transferred to the buffer. after siocr1 cleared, the receiving is ended at the ti me that the final bit of the data has been received. that the receiving has ended can be determined from the st atus of siosr. siosr is cleared to ?0? when the receiv- ing is ended. after confirmed the r eceiving termination, the final receiving data is read. when siocr1 is set, the receiving is immediately ended and si osr is cleared to ?0 ?. (the received data is ignored, and it is not required to be read out.) if it is necessary to change the number of words in external clock operation, siocr1 should be cleared to ?0? then siocr2 mu st be rewritten after confirming th at siosr ha s been cleared to ?0?. if it is necessary to change the number of words in internal clock, during automatic-wait operation which occurs after completion of data recei ving, siocr2 must be rewritten before the received data is read out. note:the buffer contents are lost when the transfer mode is switched. if it should become necessary to switch the transfer mode, end receiving by cl earing siocr1 to ?0?, read the last data and then switch the trans- fer mode. msb of last word t sodh = min 3.5/fc [s] ( in the normal1/2, idle1/2 modes) t sodh = min 3.5/fs [s] (in the slow1/2, sleep1/2 modes) sck pin so pin siosr
page 159 TMP86FS28FG figure 11-10 receive mode (example: 8bit, 1word transfer , internal clock) 11.6.3 8-bit trans fer / receive mode after setting the sio control register to the 8-bit transmit/recei ve mode, write the data to be transmitted first to the data buffer registers (dbr). after that, enable the transmit/receive by sett ing siocr1 to ?1?. when transmitting, the data are output from the so pin at leading edges of the serial clock. when receiving, the data are input to the si pin at th e trailing edges of the serial clock. wh en the all receive is enabled, 8-bit data are transferred from th e shift register to the data buffer regist er. an intsio interrupt is generated when the number of data words specified with the siocr2 has been tr ansferred. usually, read the receive data from the buffer register in the interrupt service. the data buffer register is used for both transmitting and receiving; therefore, always writ e the data to be transmitted af ter reading the all received data. when the internal clock is used, a wait is initiated until the received data are read and the next transfer data are written. a wait will not be initiated if ev en one transfer data word has been written. when an external clock is used, the shift operation is synchronized with the external clock; therefore, it is necessary to read the received data and write the data to be transmitted next before starting the next shift oper- ation. when an external clock is us ed, the transfer speed is determined by the maximum delay between genera- tion of an interrupt request and the received data are read and the data to be transmitted next are written. the transmit/receive operatio n is ended by clearing siocr1 to ?0? or setting siocr1 to ?1? in intsio interrupt service program. when siocr1 is cleared, the current data ar e transferred to the buff er. after siocr1 cleared, the transmitting/ receiving is ended at the time that the fi nal bit of the data has been transmitted. that the transmitting/ receiving has ended can be determined from the status of siosr. siosr is cleared to ?0? when the transmitting/recei ving is ended. when siocr1 is set, the transmit/receive operation is immediately ended and siosr is cleared to ?0?. if it is necessary to change the number of words in external clock operation, siocr1 should be cleared to ?0?, then sio cr2 must be rewritten after confirmi ng that siosr has been cleared to ?0?. if it is necessary to change the number of words in internal clock, during automatic-wait operation which occurs after completion of transmit/ receive operation, siocr2 must be rewritten before reading and writing of the receive/transmit data. a 1 a 0 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 dbr b a clear sios read out read out sck pin (output) si pin intsio interrupt siocr1 siosr siosr
page 160 11. synchronous serial interface (sio) 11.6 transfer mode TMP86FS28FG note:the buffer contents are lost when the transfer mode is switched. if it should become necessary to switch the transfer mode, end receiving by cl earing siocr1 to ?0?, read the last data and then switch the trans- fer mode. figure 11-11 transfer / receive mode (examp le: 8bit, 1word transf er, internal clock) figure 11-12 transmitted data hold time at end of transfer / receive a 1 a 0 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 c 1 c 0 c 2 c 3 c 4 c 5 c b c 6 c 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 clear sios dbr d a read out (c) write (a) read out (d) write (b) sck pin (output) so pin intsio interrupt siocr1 siosr siosr si pin bit 7 of last word bit 6 t sodh = min 4/fc [s] ( in the normal1/2, idle1/2 modes) t sodh = min 4/fs [s] (in the slow1/2, sleep1/2 modes) sck pin so pin siosr
page 161 TMP86FS28FG 12. asynchronous serial interface (uart1 ) 12.1 configuration figure 12-1 uart1 (asynch ronous serial interface) counter y a b c s s a b c d y e f g h uart status register uart control register 2 uart control register 1 transmit data buffer receive data buffer fc/13 fc/26 fc/52 fc/104 fc/208 fc/416 fc/96 stop bit parity bit fc/2 6 fc/2 7 fc/2 8 baud rate generator transmit/receive clock 2 4 3 2 2 2 noise rejection circuit m p x transmit control circuit shift register shift register receive control circuit mpx: multiplexer uart1cr1 td1buf rd1buf inttxd1 intrxd1 uart1sr uart1cr2 rxd1 txd1 inttc5
page 162 12. asynchronous serial interface (uart1 ) 12.2 control TMP86FS28FG 12.2 control uart1 is controlled by the uart1 control registers (uart1cr1, uart1cr2). the operating status can be monitored using the uart status register (uart1sr). note 1: when operations are disabled by se tting txe and rxe bit to ?0?, the setting be comes valid when data transmit or receive complete. when the transmit data is stored in the transmit data buf fer, the data are not transmitted. even if data transmit is enabled, until new data are written to the transmit data buffer, the current data are not transmitted. note 2: the transmit clock and the parity are common to transmit and receive. note 3: uart1cr1 and uart1cr1 should be set to ?0? before uart1cr1 is changed. note: when uart1cr2 = ?01?, pulses longer than 96/fc [s] are always regarded as signals; when uart1cr2 = ?10?, longer than 192/fc [s]; and when uart1cr2 = ?11?, longer than 384/fc [s]. uart1 control register1 uart1cr1 (0fe8h) 76543210 txe rxe stbt even pe brg (initial value: 0000 0000) txe transfer operation 0: 1: disable enable write only rxe receive operation 0: 1: disable enable stbt transmit stop bit length 0: 1: 1 bit 2 bits even even-numbered parity 0: 1: odd-numbered parity even-numbered parity pe parity addition 0: 1: no parity parity brg transmit clock select 000: 001: 010: 011: 100: 101: 110: 111: fc/13 [hz] fc/26 fc/52 fc/104 fc/208 fc/416 tc5 ( input inttc5) fc/96 uart1 control register2 uart1cr2 (0fe9h) 7654321 0 rxdnc stopbr (initial value: **** *000) rxdnc selection of rxd input noise rejection time 00: 01: 10: 11: no noise rejection (hysteresis input) rejects pulses shorter than 31/fc [s] as noise rejects pulses shorter than 63/fc [s] as noise rejects pulses shorter than 127/fc [s] as noise write only stopbr receive stop bit length 0: 1: 1 bit 2 bits
page 163 TMP86FS28FG note: when an inttxd is generated, tbep flag is set to "1" automatically. uart1 status register uart1sr (0fe8h) 76543210 perr ferr oerr rbfl tend tbep (initial value: 0000 11**) perr parity error flag 0: 1: no parity error parity error read only ferr framing error flag 0: 1: no framing error framing error oerr overrun error flag 0: 1: no overrun error overrun error rbfl receive data buffer full flag 0: 1: receive data buffer empty receive data buffer full tend transmit end flag 0: 1: on transmitting transmit end tbep transmit data buffer empty flag 0: 1: transmit data buffer full (transmit data writing is finished) transmit data buffer empty uart1 receive data buffer rd1buf (0feah) 76543210read only (initial value: 0000 0000) uart1 transmit data buffer td1buf (0feah) 76543210write only (initial value: 0000 0000)
page 164 12. asynchronous serial interface (uart1 ) 12.3 transfer data format TMP86FS28FG 12.3 transfer data format in uart1, an one-bit start bit (low level), stop bit (b it length selectable at high level, by uart1cr1), and parity (select parity in uart1cr1; even- or odd-numbered parity by uart1cr1) are added to the transfer data. the transfer da ta formats are shown as follows. figure 12-2 tran sfer data format figure 12-3 caution on c hanging transfer data format note: in order to switch the transfer data format, perfor m transmit operations in the above figure 12-3 sequence except for the initial setting. start bit 0 bit 1 bit 6 bit 7 stop 1 start bit 0 bit 1 bit 6 bit 7 stop 1 stop 2 start bit 0 bit 1 bit 6 bit 7 parity stop 1 start bit 0 bit 1 bit 6 bit 7 parity stop 1 stop 2 pe 0 0 1 1 stbt frame length 0 1 123 89101112 0 1 without parity / 1 stop bit with parity / 1 stop bit without parity / 2 stop bit with parity / 2 stop bit
page 165 TMP86FS28FG 12.4 transfer rate the baud rate of uart1 is set of uart1cr1. th e example of the baud rate are shown as follows. when tc5 is used as the uart1 transfer rate (when uart1cr1 = ?110?), the transfer clock and transfer rate are determined as follows: transfer clock [hz] = tc5 source clock [hz] / ttreg5 setting value transfer rate [baud] = transfer clock [hz] / 16 12.5 data sampling method the uart1 receiver keeps sampling input using the clock selected by uart1cr1 until a start bit is detected in rxd1 pin input. rt clock starts detecting ?l? level of the rxd1 pin. once a start bit is detected, the start bit, data bits, stop bi t(s), and parity bit are sample d at three times of rt7, rt8, and rt9 during one receiver clock interval (rt clock). (rt0 is the position where the bit supposedly starts.) bit is determined according to major- ity rule (the data are the same tw ice or more out of three samplings). figure 12-4 data sampling method table 12-1 transfer rate (example) brg source clock 16 mhz 8 mhz 4 mhz 000 76800 [baud] 38400 [baud] 19200 [baud] 001 38400 19200 9600 010 19200 9600 4800 011 9600 4800 2400 100 4800 2400 1200 101 2400 1200 600 rt0 1 2 3 4 5 6 7 8 9101112 1314 15  01234567891011 bit 0 start bit bit 0 start bit (a) without noise rejection circuit rt clock internal receive data rt0 1 2 3 4 5 6 7 8 9101112 1314 15  01234567891011 bit 0 start bit bit 0 start bit rt clock internal receive data (b) with noise rejection circuit rxd1 pin rxd1 pin
page 166 12. asynchronous serial interface (uart1 ) 12.6 stop bit length TMP86FS28FG 12.6 stop bit length select a transmit stop bit length (1 bit or 2 bits) by uart1cr1. 12.7 parity set parity / no parity by uart1cr1 and set parity type (odd- or even-numbered) by uart1cr1. 12.8 transmit/receive operation 12.8.1 data transmit operation set uart1cr1 to ?1?. read uart1sr to check uart1sr = ?1?, then write data in td1buf (transmit data buffer). writing data in td1buf zero-clears uart1sr< tbep>, transfers the data to the transmit shift register and the data are sequentiall y output from the txd1 pin. the data output include a one-bit start bit, stop bits whose number is specified in uart1cr1 and a par ity bit if parity addition is specified. select the data transfer baud rate usin g uart1cr1. when data transmit starts, transmit buffer empty flag uart1sr is set to ?1? and an inttxd1 interrupt is generated. while uart1cr1 = ?0? and from when ?1? is wr itten to uart1cr1 to when send data are written to td1buf, the txd1 pin is fixed at high level. when transmitting data, first read uart1sr, then write data in td 1buf. otherwise, uart1sr is not zero-cleared and transmit does not start. 12.8.2 data receive operation set uart1cr1 to ?1?. when data are received vi a the rxd1 pin, the receive data are transferred to rd1buf (receive data buffer). at this time, the data transmitted includes a st art bit and stop bit(s) and a parity bit if parity addition is specified. when stop bit(s) are received, data only are extracted and transferred to rd1buf (receive data buffer). then the receive buffe r full flag uart1sr is set and an intrxd1 interrupt is generated. select the data transfer baud rate using uart1cr1. if an overrun error (o err) occurs when data are received, the da ta are not transferre d to rd1buf (receive data buffer) but discarded; data in the rd1buf are not affected. note:when a receive operation is dis abled by setting uart1cr1 bit to ?0?, the setting becomes valid when data receive is completed. however, if a framing error occurs in data receive, the receive-disabling setting may not become valid. if a framing error occurs , be sure to perform a re-receive operation.
page 167 TMP86FS28FG 12.9 status flag 12.9.1 parity error when parity determined using the receive data bits diff ers from the received parity bit, the parity error flag uart1sr is set to ?1?. the uart1sr is cleared to ?0? when the rd1buf is read after reading the uart1sr. figure 12-5 generati on of parity error 12.9.2 framing error when ?0? is sampled as the stop bit in the receive da ta, framing error flag uart1sr is set to ?1?. the uart1sr is cleared to ?0? when th e rd1buf is read after reading the uart1sr. figure 12-6 generati on of framing error 12.9.3 overrun error when all bits in the next data are received while unread data are still in rd1buf, overrun error flag uart1sr is set to ?1?. in this case, the receive data is discarded; data in rd1buf are not affected. the uart1sr is cleared to ?0? when th e rd1buf is read after reading the uart1sr. parity stop shift register pxxxx0 * 1pxxxx0 xxxx0 ** rxd1 pin uart1sr intrxd1 interrupt after reading uart1sr then rd1buf clears perr. final bit stop shift register xxxx0 * 0xxxx0 xxx0 ** rxd1 pin uart1sr intrxd1 interrupt after reading uart1sr then rd1buf clears ferr.
page 168 12. asynchronous serial interface (uart1 ) 12.9 status flag TMP86FS28FG figure 12-7 generati on of overrun error note:receive operations are di sabled until the overrun error flag uart1sr is cleared. 12.9.4 receive data buffer full loading the received data in rd1buf sets receive data buffer full flag uart1sr to "1". the uart1sr is cleared to ?0? when the rd1buf is read afte r reading the uart1sr. figure 12-8 generat ion of receive data buffer full note:if the overrun error flag uart1sr is set during the period between reading the uart1sr and read- ing the rd1buf, it cannot be cleared by only reading t he rd1buf. therefore, after reading the rd1buf, read the uart1sr again to check whether or not the overrun error flag which should have been cleared still remains set. 12.9.5 transmit data buffer empty when no data is in the transmit buffer td1buf, that is, when data in td1buf are transferred to the transmit shift register and data transmit starts, transmit data buffer empty flag uart1sr is set to ?1?. the uart1sr is cleared to ?0? when the td 1buf is written after reading the uart1sr. final bit stop shift register xxxx0 * 1xxxx0 yyyy xxx0 ** rxd1 pin uart1sr intrxd1 interrupt after reading uart1sr then rd1buf clears oerr. rd1buf uart1sr final bit stop shift register xxxx0 * 1xxxx0 xxxx yyyy xxx0 ** rxd1 pin uart1sr intrxd1 interrupt rd1buf after reading uart1sr then rd1buf clears rbfl.
page 169 TMP86FS28FG figure 12-9 generation of transmit data buffer empty 12.9.6 transmit end flag when data are transmitted and no data is in td1buf (uart1sr = ?1?), transmit end flag uart1sr is set to ?1?. the uart1sr is cleared to ?0? when the data transmit is started after writing the td1buf. figure 12-10 generation of transmit end flag and transmit data buffer empty shift register data write data write zzzz xxxx yyyy start bit 0 final bit stop 1xxxx0 ***** 1 * 1xxxx **** 1x ***** 1 1yyyy0 td1buf txd1 pin uart1sr inttxd1 interrupt after reading uart1sr writing td1buf clears tbep. shift register * 1yyyy *** 1 xx **** 1 x ***** 1 stop start 1yyyy0 bit 0 txd1 pin uart1sr uart1sr inttxd1 interrupt data write for td1buf
page 170 12. asynchronous serial interface (uart1 ) 12.9 status flag TMP86FS28FG
page 171 TMP86FS28FG 13. asynchronous serial interface (uart0 ) 13.1 configuration figure 13-1 uart0 (asynch ronous serial interface) counter y a b c s s a b c d y e f g h uart status register uart control register 2 uart control register 1 transmit data buffer receive data buffer fc/13 fc/26 fc/52 fc/104 fc/208 fc/416 fc/96 stop bit parity bit fc/2 6 fc/2 7 fc/2 8 baud rate generator transmit/receive clock 2 4 3 2 2 2 noise rejection circuit m p x transmit control circuit shift register shift register receive control circuit mpx: multiplexer uart0cr1 td0buf rd0buf inttxd0 intrxd0 uart0sr uart0cr2 rxd0 txd0 inttc3
page 172 13. asynchronous serial interface (uart0 ) 13.2 control TMP86FS28FG 13.2 control uart0 is controlled by the uart0 control registers (uart0cr1, uart0cr2). the operating status can be monitored using the uart status register (uart0sr). note 1: when operations are disabled by se tting txe and rxe bit to ?0?, the setting be comes valid when data transmit or receive complete. when the transmit data is stored in the transmit data buf fer, the data are not transmitted. even if data transmit is enabled, until new data are written to the transmit data buffer, the current data are not transmitted. note 2: the transmit clock and the parity are common to transmit and receive. note 3: uart0cr1 and uart0cr1 should be set to ?0? before uart0cr1 is changed. note: when uart0cr2 = ?01?, pulses longer than 96/fc [s] are always regarded as signals; when uart0cr2 = ?10?, longer than 192/fc [s]; and when uart0cr2 = ?11?, longer than 384/fc [s]. uart0 control register1 uart0cr1 (0fe5h) 76543210 txe rxe stbt even pe brg (initial value: 0000 0000) txe transfer operation 0: 1: disable enable write only rxe receive operation 0: 1: disable enable stbt transmit stop bit length 0: 1: 1 bit 2 bits even even-numbered parity 0: 1: odd-numbered parity even-numbered parity pe parity addition 0: 1: no parity parity brg transmit clock select 000: 001: 010: 011: 100: 101: 110: 111: fc/13 [hz] fc/26 fc/52 fc/104 fc/208 fc/416 tc3 ( input inttc3) fc/96 uart0 control register2 uart0cr2 (0fe6h) 7654321 0 rxdnc stopbr (initial value: **** *000) rxdnc selection of rxd input noise rejection time 00: 01: 10: 11: no noise rejection (hysteresis input) rejects pulses shorter than 31/fc [s] as noise rejects pulses shorter than 63/fc [s] as noise rejects pulses shorter than 127/fc [s] as noise write only stopbr receive stop bit length 0: 1: 1 bit 2 bits
page 173 TMP86FS28FG note: when an inttxd is generated, tbep flag is set to "1" automatically. uart0 status register uart0sr (0fe5h) 76543210 perr ferr oerr rbfl tend tbep (initial value: 0000 11**) perr parity error flag 0: 1: no parity error parity error read only ferr framing error flag 0: 1: no framing error framing error oerr overrun error flag 0: 1: no overrun error overrun error rbfl receive data buffer full flag 0: 1: receive data buffer empty receive data buffer full tend transmit end flag 0: 1: on transmitting transmit end tbep transmit data buffer empty flag 0: 1: transmit data buffer full (transmit data writing is finished) transmit data buffer empty uart0 receive data buffer rd0buf (0fe7h) 76543210read only (initial value: 0000 0000) uart0 transmit data buffer td0buf (0fe7h) 76543210write only (initial value: 0000 0000)
page 174 13. asynchronous serial interface (uart0 ) 13.3 transfer data format TMP86FS28FG 13.3 transfer data format in uart0, an one-bit start bit (low level), stop bit (b it length selectable at high level, by uart0cr1), and parity (select parity in uart0cr1; even- or odd-numbered parity by uart0cr1) are added to the transfer data. the transfer da ta formats are shown as follows. figure 13-2 tran sfer data format figure 13-3 caution on c hanging transfer data format note: in order to switch the transfer data format, perfor m transmit operations in the above figure 13-3 sequence except for the initial setting. start bit 0 bit 1 bit 6 bit 7 stop 1 start bit 0 bit 1 bit 6 bit 7 stop 1 stop 2 start bit 0 bit 1 bit 6 bit 7 parity stop 1 start bit 0 bit 1 bit 6 bit 7 parity stop 1 stop 2 pe 0 0 1 1 stbt frame length 0 1 123 89101112 0 1 without parity / 1 stop bit with parity / 1 stop bit without parity / 2 stop bit with parity / 2 stop bit
page 175 TMP86FS28FG 13.4 transfer rate the baud rate of uart0 is set of uart0cr1. th e example of the baud rate are shown as follows. when tc3 is used as the uart0 transfer rate (when uart0cr1 = ?110?), the transfer clock and transfer rate are determined as follows: transfer clock [hz] = tc3 source clock [hz] / ttreg3 setting value transfer rate [baud] = transfer clock [hz] / 16 13.5 data sampling method the uart0 receiver keeps sampling input using the clock selected by uart0cr1 until a start bit is detected in rxd0 pin input. rt clock starts detecting ?l? level of the rxd0 pin. once a start bit is detected, the start bit, data bits, stop bi t(s), and parity bit are sample d at three times of rt7, rt8, and rt9 during one receiver clock interval (rt clock). (rt0 is the position where the bit supposedly starts.) bit is determined according to major- ity rule (the data are the same tw ice or more out of three samplings). figure 13-4 data sampling method table 13-1 transfer rate (example) brg source clock 16 mhz 8 mhz 4 mhz 000 76800 [baud] 38400 [baud] 19200 [baud] 001 38400 19200 9600 010 19200 9600 4800 011 9600 4800 2400 100 4800 2400 1200 101 2400 1200 600 rt0 1 2 3 4 5 6 7 8 9101112 1314 15  01234567891011 bit 0 start bit bit 0 start bit (a) without noise rejection circuit rt clock internal receive data rt0 1 2 3 4 5 6 7 8 9101112 1314 15  01234567891011 bit 0 start bit bit 0 start bit rt clock internal receive data (b) with noise rejection circuit rxd0 pin rxd0 pin
page 176 13. asynchronous serial interface (uart0 ) 13.6 stop bit length TMP86FS28FG 13.6 stop bit length select a transmit stop bit length (1 bit or 2 bits) by uart0cr1. 13.7 parity set parity / no parity by uart0cr1 and set parity type (odd- or even-numbered) by uart0cr1. 13.8 transmit/receive operation 13.8.1 data transmit operation set uart0cr1 to ?1?. read uart0sr to check uart0sr = ?1?, then write data in td0buf (transmit data buffer). writing data in td0buf zero-clears uart0sr< tbep>, transfers the data to the transmit shift register and the data are sequentiall y output from the txd0 pin. the data output include a one-bit start bit, stop bits whose number is specified in uart0cr1 and a par ity bit if parity addition is specified. select the data transfer baud rate usin g uart0cr1. when data transmit starts, transmit buffer empty flag uart0sr is set to ?1? and an inttxd0 interrupt is generated. while uart0cr1 = ?0? and from when ?1? is wr itten to uart0cr1 to when send data are written to td0buf, the txd0 pin is fixed at high level. when transmitting data, first read uart0sr, then write data in td 0buf. otherwise, uart0sr is not zero-cleared and transmit does not start. 13.8.2 data receive operation set uart0cr1 to ?1?. when data are received vi a the rxd0 pin, the receive data are transferred to rd0buf (receive data buffer). at this time, the data transmitted includes a st art bit and stop bit(s) and a parity bit if parity addition is specified. when stop bit(s) are received, data only are extracted and transferred to rd0buf (receive data buffer). then the receive buffe r full flag uart0sr is set and an intrxd0 interrupt is generated. select the data transfer baud rate using uart0cr1. if an overrun error (o err) occurs when data are received, the da ta are not transferre d to rd0buf (receive data buffer) but discarded; data in the rd0buf are not affected. note:when a receive operation is dis abled by setting uart0cr1 bit to ?0?, the setting becomes valid when data receive is completed. however, if a framing error occurs in data receive, the receive-disabling setting may not become valid. if a framing error occurs , be sure to perform a re-receive operation.
page 177 TMP86FS28FG 13.9 status flag 13.9.1 parity error when parity determined using the receive data bits diff ers from the received parity bit, the parity error flag uart0sr is set to ?1?. the uart0sr is cleared to ?0? when the rd0buf is read after reading the uart0sr. figure 13-5 generati on of parity error 13.9.2 framing error when ?0? is sampled as the stop bit in the receive da ta, framing error flag uart0sr is set to ?1?. the uart0sr is cleared to ?0? when th e rd0buf is read after reading the uart0sr. figure 13-6 generati on of framing error 13.9.3 overrun error when all bits in the next data are received while unread data are still in rd0buf, overrun error flag uart0sr is set to ?1?. in this case, the receive data is discarded; data in rd0buf are not affected. the uart0sr is cleared to ?0? when th e rd0buf is read after reading the uart0sr. parity stop shift register pxxxx0 * 1pxxxx0 xxxx0 ** rxd0 pin uart0sr intrxd0 interrupt after reading uart0sr then rd0buf clears perr. final bit stop shift register xxxx0 * 0xxxx0 xxx0 ** rxd0 pin uart0sr intrxd0 interrupt after reading uart0sr then rd0buf clears ferr.
page 178 13. asynchronous serial interface (uart0 ) 13.9 status flag TMP86FS28FG figure 13-7 generati on of overrun error note:receive operations are di sabled until the overrun error flag uart0sr is cleared. 13.9.4 receive data buffer full loading the received data in rd0buf sets receive data buffer full flag uart0sr to "1". the uart0sr is cleared to ?0? when the rd0buf is read afte r reading the uart0sr. figure 13-8 generat ion of receive data buffer full note:if the overrun error flag uart0sr is set during the period between reading the uart0sr and read- ing the rd0buf, it cannot be cleared by only reading t he rd0buf. therefore, after reading the rd0buf, read the uart0sr again to check whether or not the overrun error flag which should have been cleared still remains set. 13.9.5 transmit data buffer empty when no data is in the transmit buffer td0buf, that is, when data in td0buf are transferred to the transmit shift register and data transmit starts, transmit data buffer empty flag uart0sr is set to ?1?. the uart0sr is cleared to ?0? when the td 0buf is written after reading the uart0sr. final bit stop shift register xxxx0 * 1xxxx0 yyyy xxx0 ** rxd0 pin uart0sr intrxd0 interrupt after reading uart0sr then rd0buf clears oerr. rd0buf uart0sr final bit stop shift register xxxx0 * 1xxxx0 xxxx yyyy xxx0 ** rxd0 pin uart0sr intrxd0 interrupt rd0buf after reading uart0sr then rd0buf clears rbfl.
page 179 TMP86FS28FG figure 13-9 generation of transmit data buffer empty 13.9.6 transmit end flag when data are transmitted and no data is in td0buf (uart0sr = ?1?), transmit end flag uart0sr is set to ?1?. the uart0sr is cleared to ?0? when the data transmit is started after writing the td0buf. figure 13-10 generation of transmit end flag and transmit data buffer empty shift register data write data write zzzz xxxx yyyy start bit 0 final bit stop 1xxxx0 ***** 1 * 1xxxx **** 1x ***** 1 1yyyy0 td0buf txd0 pin uart0sr inttxd0 interrupt after reading uart0sr writing td0buf clears tbep. shift register * 1yyyy *** 1 xx **** 1 x ***** 1 stop start 1yyyy0 bit 0 txd0 pin uart0sr uart0sr inttxd0 interrupt data write for td0buf
page 180 13. asynchronous serial interface (uart0 ) 13.9 status flag TMP86FS28FG
page 181 TMP86FS28FG 14. 10-bit ad converter (adc) the TMP86FS28FG have a 10-bit successi ve approximation type ad converter. 14.1 configuration the circuit configuration of the 10-bit ad converter is shown in figure 14-1. it consists of control register adccr1 and adccr2 , converted value register adcdr1 and adcdr2, a da converter, a sample-hold circuit, a compar ator, and a successive comparison circuit. note: before using ad converter, set appropriate value to i/o port register conbining a analog input port. for details, see the sec- tion on "i/o ports". figure 14-1 10-bit ad converter 2 4 10 8 ainds adrs r/2 r/2 r ack amd irefon ad conversion result register 1, 2 ad converter control register 1, 2 adbf eocf intadc sain n successive approximate circuit adccr2 adcdr1 adcdr2 adccr1  sample hold circuit a s en shift clock da converter analog input multiplexer y reference voltage analog comparator 2 3 control circuit avss varef avdd ain0 ain7
page 182 14. 10-bit ad converter (adc) 14.2 register configuration TMP86FS28FG 14.2 register configuration the ad converter consists of the following four registers: 1. ad converter control register 1 (adccr1) this register selects the analog channels and operatio n mode (software start or repeat) in which to per- form ad conversion and controls the ad converter as it starts operating. 2. ad converter control register 2 (adccr2) this register selects the ad conversion time and co ntrols the connection of the da converter (ladder resistor network). 3. ad converted value register 1 (adcdr1) this register used to store the digital value fter being converted by the ad converter. 4. ad converted value register 2 (adcdr2) this register monitors the oper ating status of the ad converter. note 1: select analog input channel during ad converter stops (adcdr2 = "0"). note 2: when the analog input channel is all use dis abling, the adccr1 should be set to "1". note 3: during conversion, do not perform port output instruction to maintain a precision for all of the pins because analog inp ut port use as general input port. and for port near to anal og input, do not input intense signaling of change. note 4: the adccr1 is automatically cleared to "0" after starting conversion. note 5: do not set adccr1 newly again during ad conv ersion. before setting adccr1 newly again, check adcdr2 to see that the conversion is completed or wait until the interrupt signal (intadc) is generated (e.g., interrupt handling routine). note 6: after stop or slow/sleep mode are started, ad conver ter control register1 (adccr1) is all initialized and no data can be written in this register. therfore, to use ad converter again, set the adccr1 newly after returning to normal1 or normal2 mode. ad converter control register 1 adccr1 (0fe2h) 76543210 adrs amd ainds sain (initial value: 0001 0000) adrs ad conversion start 0: 1: - ad conversion start r/w amd ad operating mode 00: 01: 10: 11: ad operation disable software start mode reserved repeat mode ainds analog input control 0: 1: analog input enable analog input disable sain analog input channel select 0000: 0001: 0010: 0011: 0100: 0101: 0110: 0111: 1000: 1001: 1010: 1011: 1100: 1101: 1110: 1111: ain0 ain1 ain2 ain3 ain4 ain5 ain6 ain7 reserved reserved reserved reserved reserved reserved reserved reserved
page 183 TMP86FS28FG note 1: always set bit0 in adccr2 to "0" and set bit4 in adccr2 to "1". note 2: when a read instruction for adccr2, bi t6 to 7 in adccr2 read in as undefined data. note 3: after stop or slow/sleep mode are started, ad conver ter control register2 (adccr2) is all initialized and no data can be written in this register. therfore, to use ad converter again, set the adccr2 newly after returning to normal1 or normal2 mode. note 1: setting for "  " in the above table are inhibited. fc: high frequency oscillation clock [hz] note 2: set conversion time setting should be kept more t han the following time by analog reference voltage (varef) . ad converter control register 2 adccr2 (0fe3h) 76543210 irefon "1" ack "0" (initial value: **0* 000*) irefon da converter (ladder resistor) connection control 0: 1: connected only during ad conversion always connected r/w ack ad conversion time select (refer to the following table about the con- version time) 000: 001: 010: 011: 100: 101: 110: 111: 39/fc reserved 78/fc 156/fc 312/fc 624/fc 1248/fc reserved table 14-1 ack setting and conversion time condition conversion time 16 mhz 8 mhz 4 mhz 2 mhz 10 mhz 5 mhz 2.5 mhz ack 000 39/fc - - - 19.5 p s - - 15.6 p s 001 reserved 010 78/fc - - 19.5 p s 39.0 p s - 15.6 p s 31.2 p s 011 156/fc - 19.5 p s 39.0 p s 78.0 p s 15.6 p s 31.2 p s 62.4 p s 100 312/fc 19.5 p s39.0 p s 78.0 p s 156.0 p s 31.2 p s 62.4 p s124.8 p s 101 624/fc 39.0 p s78.0 p s 156.0 p s - 62.4 p s124.8 p s- 110 1248/fc 78.0 p s 156.0 p s - - 124.8 p s- - 111 reserved - varef = 4.5 to 5.5 v 15.6 p s and more - varef = 2.7 to 5.5 v 31.2 p s and more ad converted value register 1 adcdr1 (0fe1h) 76543210 ad09 ad08 ad07 ad06 ad05 ad04 ad03 ad02 (initial value: 0000 0000) ad converted value register 2 adcdr2 (0fe0h) 76543210 ad01 ad00 eocf adbf (initial value: 0000 ****)
page 184 14. 10-bit ad converter (adc) 14.2 register configuration TMP86FS28FG note 1: the adcdr2 is cleared to "0" when reading the a dcdr1. therfore, the ad conversion result should be read to adcdr2 more first than adcdr1. note 2: the adcdr2 is set to "1" when ad conversion star ts, and cleared to "0" when ad conversion finished. it also is cleared upon entering stop mode or slow mode . note 3: if a read instruction is executed for a dcdr2, read data of bit3 to bit0 are unstable. eocf ad conversion end flag 0: 1: before or during conversion conversion completed read only adbf ad conversion busy flag 0: 1: during stop of ad conversion during ad conversion
page 185 TMP86FS28FG 14.3 function 14.3.1 software start mode after setting adccr1 to ?01? (software start mode), set adccr1 to ?1?. ad conver- sion of the voltage at the analog input pin specified by adccr1 is thereby started. after completion of the ad conversion, the conversion result is stored in ad converted value registers (adcdr1, adcdr2) and at the same time adcdr2 is set to 1, the ad conversion finished inter- rupt (intadc) is generated. adrs is automatically cleared afte r ad conversion has started. do not set adccr1 newly again (restart) during ad conversion. before setting adrs newly again, check adcdr2 to see that the conversion is completed or wait until the interrupt signa l (intadc) is generated (e.g., interrupt handling rou- tine). figure 14-2 software start mode 14.3.2 repeat mode ad conversion of the voltage at the analog input pin specified by adccr1 is performed repeatedly. in this mode, ad conversion is started by setti ng adccr1 to ?1? after setting adccr1 to ?11? (repeat mode). after completion of the ad conversion, the conversion result is stored in ad converted value registers (adcdr1, adcdr2) and at the same time adcdr2 is set to 1, the ad conversion finished inter- rupt (intadc) is generated. in repeat mode, each time one ad conversion is complete d, the next ad conversion is started. to stop ad conversion, set adccr1 to ?00? (disable mode) by writing 0s. the ad convert operation is stopped immediately. the converted valu e at this time is not stored in the ad converted value register. adcdr1 status eocf cleared by reading conversion result conversion result read adcdr2 intadc interrupt request adcdr2 adccr1 1st conversion result 2nd conversion result indeterminate ad conversion start ad conversion start a dcdr1 a dcdr2 conversion result read conversion result read conversion result read
page 186 14. 10-bit ad converter (adc) 14.3 function TMP86FS28FG figure 14-3 repeat mode 14.3.3 regi ster setting 1. set up the ad converter control register 1 (adccr1) as follows: ? choose the channel to ad convert using ad input channel select (sain). ? specify analog input enable fo r analog input control (ainds). ? specify amd for the ad converter control operation mode (software or repeat mode). 2. set up the ad converter control register 2 (adccr2) as follows: ? set the ad conversion time using ad conversion time (ack). for details on how to set the con- version time, refer to figure 14-1 and ad converter control register 2. ? choose irefon for da converter control. 3. after setting up (1) and (2) above, set ad conversion start (adrs) of ad converter control register 1 (adccr1) to ?1?. if software start mode has been selected, ad conversi on starts immediately. 4. after an elapse of the specified ad conversion time, the ad converted value is stored in ad con- verted value register 1 (adcdr1) and the ad conv ersion finished flag (e ocf) of ad converted value register 2 (adcdr2) is set to ?1?, upon wh ich time ad conversion interrupt intadc is gener- ated. 5. eocf is cleared to ?0? by a read of the conversion result. however, if reconverted before a register read, although eocf is cl eared the previous conversi on result is retained until the next conversion is completed. a dcdr1,adcdr2 eocf cleared by reading conversion result conversion result read a dcdr2 intadc interrupt request conversion operation a dccr1 indeterminate ad conversion start adccr1 ?11? ?00? 1st conversion result ad convert operation suspended. conversion result is not stored. 2nd conversion result 3rd conversion result a dcdr1 a dcdr2 2nd conversion result 3rd conversion result 1st conversion result conversion result read conversion result read conversion result read conversion result read conversion result read
page 187 TMP86FS28FG 14.4 stop/slow modes during ad conversion when standby mode (stop or slow mode) is entered fo rcibly during ad conversi on, the ad convert operation is suspended and the ad converter is in itialized (adccr1 and adccr2 are initia lized to initial value). also, the conversion result is indeterminate. (conversion results up to the previous operation are cleared, so be sure to read the conversion results before entering standby mode (sto p or slow mode).) when restored from standby mode (stop or slow mode), ad conversion is not automatically restarted, so it is necessa ry to restart ad conversion. note that since the analog reference voltage is automatically disconnected, there is no possibility of current flowing into the analog reference voltage. example :after selecting the conversion time 19.5 p s at 16 mhz and the analog input channel ain3 pin, perform ad con- version once. after checking eocf, read the converted value, store the lower 2 bits in address 0009eh nd store the upper 8 bits in address 0009fh in ram. the operation mode is software start mode. : (port setting) : ;set port register approrriately before setting ad converter registers. : : (refer to section i/o port in details) ld (adccr1) , 00100011b ; select ain3 ld (adccr2) , 11011000b ;select conversion time(312/fc) and operation mode set (adccr1) . 7 ; adrs = 1(ad conversion start) sloop : test (adcdr2) . 5 ; eocf= 1 ? jrs t, sloop ld a , (adcdr2) ; read result data ld (9eh) , a ld a , (adcdr1) ; read result data ld (9fh), a
page 188 14. 10-bit ad converter (adc) 14.5 analog input voltage and ad conversion result TMP86FS28FG 14.5 analog input voltage and ad conversion result the analog input voltage is corresponded to the 10-bit dig ital value converted by the ad as shown in figure 14-4. figure 14-4 analog i nput voltage and ad c onversion result (typ.) 1 0 01 h 02 h 03 h 3fd h 3fe h 3ff h 2 3 1021 1022 1023 1024 analog input voltage 1024 ad conversion result varef avss
page 189 TMP86FS28FG 14.6 precautions about ad converter 14.6.1 analog input pin voltage range make sure the analog input pins (ain0 to ain7) are used at voltages within varef to avss. if any voltage outside this range is applied to one of the analog input pins, the converted value on that pin becomes uncertain. the other analog input pins also are affected by that. 14.6.2 analog input shared pins the analog input pins (ain0 to ain7) are shared w ith input/output ports. when using any of the analog inputs to execute ad conversion, do not execute input/output instructions for all other ports. this is necessary to prevent the accuracy of ad conversi on from degrading. not only these analog input sh ared pins, some other pins may also be affected by noise arising from input/o utput to and from adjacent pins. 14.6.3 noise countermeasure the internal equivalent circuit of the analog input pins is shown in figure 14-5. the higher the output impedance of the analog input source, more easily they are susceptible to no ise. therefore, make sure the out- put impedance of the signal source in your design is 5 k : or less. toshiba also recommends attaching a capac- itor external to the chip. figure 14-5 analog i nput equivalent circuit and exam ple of input pin processing da converter aini analog comparator internal resistance permissible signal source impedance internal capacitance 5 k : (typ) c = 22 pf (typ.) 5 k : (max) note) i = 7 to 0
page 190 14. 10-bit ad converter (adc) 14.6 precautions about ad converter TMP86FS28FG
page 191 TMP86FS28FG 15. key-on wakeup (kwu) in the TMP86FS28FG, the stop mo de is released by not only p20( int5 / stop ) pin but also four (stop2 to stop5) pins. when the stop mode is released by stop2 to stop5 pins, the stop pin needs to be used. in details, refer to the following section " 15.2 control ". 15.1 configuration figure 15-1 key-on wakeup circuit 15.2 control stop2 to stop5 pins can controlled by key-on wakeup c ontrol register (stopcr). it can be configured as enable/disable in 1-bit unit. when thos e pins are used for stop mode releas e, configure corresponding i/o pins to input mode by i/o port register beforehand. 15.3 function stop mode can be entered by setting up the system control register (syscr1), and can be exited by detecting the "l" level on stop2 to stop5 pins, which are enabled by stopcr, for releasing stop mode (note1). key-on wakeup control register stopcr76543210 (0031h) stop5 stop4 stop3 stop2 (initial value: 0000 ****) stop5 stop mode released by stop5 0:disable 1:enable write only stop4 stop mode released by stop4 0:disable 1:enable write only stop3 stop mode released by stop3 0:disable 1:enable write only stop2 stop mode released by stop2 0:disable 1:enable write only stopcr int5 stop stop mode release signal (1: release) (0031h) stop2 stop3 stop4 stop5 stop2 stop3 stop4 stop5
page 192 15. key-on wakeup (kwu) 15.3 function TMP86FS28FG also, each level of the stop2 to stop5 pins can be co nfirmed by reading correspondi ng i/o port data register, check all stop2 to stop5 pins "h" that is enabled by stopcr before the stop mode is started (note2,3). note 1: when the stop mode released by the edge release mo de (syscr1 = ?0?), inhibit input from stop2 to stop5 pins by key-on wakeup control register (stopcr) or must be set "h" level into stop2 to stop5 pins that are available input during stop mode. note 2: when the stop pin input is high or stop2 to stop5 pins i nput which is enabled by stopcr is low, executing an instruction which starts stop mode wi ll not place in stop mode but instead will immediately start the release sequence (warm up). note 3: the input circuit of key-on wakeup input and port input is separated, so each input voltage threshold value is dif- ferent. therefore, a value comes from port input before stop mode start may be different from a value which is detected by key-on wakeup input (figure 15-2). note 4: stop pin doesn?t have the control register such as stop cr, so when stop mode is released by stop2 to stop5 pins, stop pin also should be used as stop mode release function. note 5: in stop mode, key-on wakeup pin which is enabled as input mode (for releasing stop mode) by key-on wakeup control register (stopcr) may generate the penet ration current, so the said pin must be disabled ad conversion input (analog voltage input). note 6: when the stop mode is released by stop2 to stop5 pins, the level of stop pin should hold "l" level (figure 15-3). figure 15-2 key-on wakeup input and port input figure 15-3 priority of stop pin and stop2 to stop5 pins table 15-1 release level (edge) of stop mode pin name release level (edge) syscr1="1" (note2) syscr1="0" stop "h" level rising edge stop2 "l" level don?t use (note1) stop3 "l" level don?t use (note1) stop4 "l" level don?t use (note1) stop5 "l" level don?t use (note1) port input external pin key-on wakeup input stop pin a) stop release stop mode stop mode stop pin "l" b) release stop mode stop mode in case of stop2 to stop5 stop2 pin
page 193 TMP86FS28FG 16. lcd driver the TMP86FS28FG has a driver and control circuit to dir ectly drive the liquid crystal device (lcd). the pins to be connected to lcd are as follows: 1. segment output port 40 pins (seg39 to seg0) 2. common output port4 pins (com3 to com0) in addition, c0, c1, v1, v2, v3 pin are provided for the lcd driver?s booster circuit. the devices that can be directly driven is sel ectable from lcd of the following drive methods: 1. 1/4 duty (1/3 bias) lcd max 160 segments(8 segments u 20 digits) 2. 1/3 duty (1/3 bias) lcd max 120 segments(8 segments u 15 digits) 3. 1/2 duty (1/2 bias) lcd max 80 segments(8 segments u 10 digits) 4. static lcd max 40 segments(8 segments u 5 digits) 16.1 configuration figure 16-1 lcd driver note: the lcd driver incorporates a ded icated divider circuit. therefore, the break function of a debugger (development tool) will not stop lcd driver output. com3 com0 v1 duty control fc/2 17 , fs/2 9 fc/2 13 fc/2 16 , fs/2 8 common driver dbr display data area display data select control timing control display data buffer register blanking control segment driver fc/2 15 lcdcr to 7 6 5 4 3 2 1 0 duty slf edsp vfsel constant voltage booster circuit bres fc/2 13 , fs/2 5 fc/2 9 fc/2 11 , fs/2 3 v2 v3 c0 c1 fc/2 10 , fs/2 2 seg0 seg39
page 194 16. lcd driver 16.2 control TMP86FS28FG 16.2 control the lcd driver is controlled using the lcd control regist er (lcdcr). the lcd driver?s display is enabled using the edsp. note 1: when (booster circui t control) is set to ?0?, v dd t v3 t v2 t v1 t v ss should be satisfied. when is set to ?1?, 5.5 [v] t v3 t v dd should be satisfied. if these conditions are not satisfied, it not only affects t he quality of lcd display but also may damage the device due to over voltage of the port. note 2: when used as the booster circuit, bias should be composed to 1/3. therefore, do not set lcdcr to "10" or "11" when the booster circuit is enable. note 3: do not set slf to ?10? or ?11? in slow1/2 modes. note 4: do not set vfsel to ?11? slow1/2 modes. lcd driver control register lcdcr (0fd9h) 76543210 edsp bres vfsel duty slf (initial value: 0000 0000) edsp lcd display control 0: blanking 1: enables lcd display (blanking is released) r/w bres booster circuit control 0: disable (use divider resistance) 1: enable vfsel selection of boost frequency normal1/2, idle/1/2 mode slow1/2, sleep0/1/2 mode dv7ck = 0 dv7ck = 1 00 fc/2 13 fs/2 5 fs/2 5 01 fc/2 11 fs/2 3 fs/2 3 10 fc/2 10 fs/2 2 fs/2 2 11 fc/2 9 fc/2 9 ? duty selection of driving methods 00: 1/4 duty (1/3 bias) 01: 1/3 duty (1/3 bias) 10: 1/2 duty (1/2 bias) 11: static slf selection of lcd frame fre- quency normal1/2, idle/1/2 mode slow1/2, sleep0/1/2 mode dv7ck = 0 dv7ck = 1 00 fc/2 17 fs/2 9 fs/2 9 01 fc/2 16 fs/28 fs/2 8 10 fc/2 15 fc/2 15 ? 11 fc/2 13 fc/2 13 ?
page 195 TMP86FS28FG 16.2.1 lcd driving methods as for lcd driving method, 4 types can be selected by lcdcr. the driving method is initialized in the initial program according to the lcd used. note 1: f f : frame frequency note 2: v lcd3 : lcd drive voltage figure 16-2 lcd drive wa veform (com-seg pins) v lcd3 1/f f 1/f f v lcd3 ? v lcd3 data "1" data "0" 0 data "1" ? v lcd3 data "0" 0 (b) 1/3 duty (1/3 bias) (a) 1/4 duty (1/3 bias) v lcd3 ? v lcd3 data "1" data "0" 1/f f 0 (d) static ? v lcd3 data "1" data "0" 1/f f v lcd3 0 (c) 1/2 duty (1/2 bias)
page 196 16. lcd driver 16.2 control TMP86FS28FG 16.2.2 frame frequency frame frequency (f f ) is set according to driving method and base frequency as shown in the following table 16-1. the base frequency is selected by lcdcr acco rding to the frequency fc and fs of the basic clock to be used. note: fc: high-frequency clock [hz] note: fs: low-frequency clock [hz] table 16-1 setting of lcd frame frequency (a) at the single clock mode. at the dual clock mode (dv7ck = 0). slf base frequency [hz] frame frequency [hz] 1/4 duty 1/3 duty 1/2 duty static 00 (fc = 16 mhz) 122 163 244 122 (fc = 8 mhz) 61 81 122 61 01 (fc = 8 mhz) 122 163 244 122 (fc = 4 mhz) 61 81 122 61 10 (fc = 4 mhz) 122 163 244 122 (fc = 2 mhz) 61 81 122 61 11 (fc = 1 mhz) 122 163 244 122 table 16-2 (b) at the dual clock mode (dv7ck = 1 or sysck = 1) slf base frequency [hz] frame frequency [hz] 1/4 duty 1/3 duty 1/2 duty static 00 (fs = 32.768 khz) 64 85 128 64 01 (fs = 32.768 khz) 128 171 256 128 fc 2 17 -------- fc 2 17 -------- 4 3 -- - fc 2 17 -------- x 4 2 -- - fc 2 17 -------- x fc 2 17 -------- fc 2 16 -------- fc 2 16 -------- 4 3 -- - fc 2 16 -------- x 4 2 -- - fc 2 16 -------- x fc 2 16 -------- fc 2 15 -------- fc 2 15 -------- 4 3 -- - fc 2 15 -------- x 4 2 -- - fc 2 15 -------- x fc 2 15 -------- fc 2 13 -------- fc 2 13 -------- 4 3 -- - fc 2 13 -------- x 4 2 -- - fc 2 13 -------- x fc 2 13 -------- fs 2 9 ----- - fs 2 9 ----- - 4 3 -- - fs 2 9 ----- - x 4 2 -- - fs 2 9 ----- - x fs 2 9 ----- - fs 2 8 ----- - fs 2 8 ----- - 4 3 -- - fs 2 8 ----- - x 4 2 -- - fs 2 8 ----- - x fs 2 8 ----- -
page 197 TMP86FS28FG 16.2.3 driving method for lcd driver in the TMP86FS28FG, lcd driving voltages can be genera ted using either an intern al booster circuit or an external resistor divider. this selection is made in lcdcr. 16.2.3.1 when using the boost er circuit (lcdcr="1") when the reference voltage is conn ected to the v1 pin, the booster circuit boosts the reference voltage twofold (v2) or threefold (v3) to generate the ou tput voltages for segment/common signals. when the reference voltage is connected to the v2 pin, it is reduced to 1/2 (v1) or boosted to 3/2 (v3). when the reference voltage is connected to the v3 pin, it is reduced to 1/3 (v1) or 2/3 (v2). lcdcr is used to select the reference fr equency in the booster circuit. the faster the boost- ing frequency, the higher the segment/common drive capability, but power consumption is increased. conversely, the slower the boosting frequency, the lower the segment/common drive capability, but power consumption is reduced. if the drive capability is insufficient, the lcd may not be displayed clearly. therefore, select an optimum boosting frequency for the lcd panel to be used. table 16-3 shows the v3 pin current capacity and boosting frequency. note: when used as the booster circ uit, bias should be composed to 1/3. therefore, do not set lcdcr to "10" or "11" when t he booster circuit is enable (lcdcr="1"). v3 v2 v1 c1 c0 vdd vss keep the following condition. v 1 = v 3 reference voltage c c c c = 0.1 to 0.47 f 1/3 x v3 a) reference pin = v1 v3 v2 v1 c1 c0 vdd vss keep the following condition. v 2 = v 3 reference voltage c c c c = 0.1 to 0.47 f b) reference pin = v2 c 2/3 x v3
page 198 16. lcd driver 16.2 control TMP86FS28FG note 1: when the TMP86FS28FG uses the booster circuit to drive the lcd, the power supply and capacitor for the booster circuit should be connected as shown above. note 2: when the reference voltage is connected to a pin other than v1, add a capacitor between v1 and gnd. note 3: the connection examples shown above are different from those shown in the dat asheets of the previous version. since the above connection method enhances the boosting characteristics, it is recommended that new boards be designed using the above connection method. (using the existi ng connection method does not affect lcd display.) figure 16-3 connection exam ples when using the booster circuit (lcdcr = ?1?) note 1: the current capacity is the amount of voltage that falls per 1 p a. note 2: the boosting frequency should be selected depending on your lcd panel. note 3: for the reference pin v1 or v2, a current capacity t en times larger than the above is recommended to ensure stable oper- ation. for example, when the boosting frequency is fc/2 9 (at fc = 8 mhz),  1.7 mv/ p a or more is recommended for the current capacity of the reference pin v1. 16.2.3.2 when using an external resistor divider (lcdcr="0") when an external resistor divider is used, the volt age of an external power supply is divided and input on v1, v2, and v3 to generate the output voltages for segment/common signals. table 16-3 v3 pin current capacity and boosting frequency (typ.) vfsel boosting frequency fc = 16 mhz fc = 8 mhz fc = 4 mhz fc = 32.768 mhz 00 fc/2 13 or fs/2 5  37 mv/ p a  80 mv/ p a  138 mv/ p a  76 mv/ p a 01 fc/2 11 or fs/2 3  19 mv/ p a  24 mv/ p a  37 mv/ p a  23 mv/ p a 10 fc/2 10 or fs/2 2  17 mv/ p a  19 mv/ p a  24 mv/ p a  18 mv/ p a 11 fc/2 9  16 mv/ p a  17 mv/ p a  19 mv/ p a? v3 v2 v1 c1 c0 vdd vss keep the following condition. v 3 c c c c = 0.1 to 0.47 f c) reference pin = v3 c reference voltage v3 v2 v1 c1 c0 vdd vss keep the following condition. c c c c = 0.1 to 0.47 f d) reference pin = v3 c v 3 =
page 199 TMP86FS28FG the smaller the external resistor value, the higher the segment/comm on drive capability, but power con- sumption is increased. conversely, the larger the external resistor value, the lower the segment/common drive capability, but power consumption is reduced. if the drive capability is insufficient, the lcd may not be displayed clearly. therefore, select an opti mum resistor value for the lcd panel to be used. figure 16-4 connection ex amples when using an exte rnal resistor divider (lcdcr = ?0?) 16.3 lcd display operation 16.3.1 display data setting display data is stored to the display data area (assigned to address 0fc0h to 0fd3h, 20bytes) in the dbr. the display data which are stored in the display data ar ea is automatically read out and sent to the lcd driver by the hardware. the lcd driver generates the segment signal and common signal according to the display data and driving method. therefore, display patterns can be changed by only over writing the contents of dis- play data area by the program. table 16-5 shows the correspondence between the display data area and seg/ com pins. lcd light when display data is ?1? and turn off when ?0?. according to the driving method of lcd, the number of pixels which can be driven becomes different, and the number of bits in the display data area which is used to store display da ta also becomes different. therefore, the bits which are not used to store display data as well as the data buffer which corresponds to the addresses not connected to lcd can be used to store general user process data (see table 16-4). note:the display data memory contents become unstable when the power supply is turned on; therefore, the dis- play data memory should be initia lized by an initiation routine. table 16-4 driving method and bit for display data driving methods bit 7/3 bit 6/2 bit 5/1 bit 4/0 1/4 duty com3 com2 com1 com0 1/3 duty ? com2 com1 com0 1/2 duty ? ? com1 com0 static ? ? ? com0 adjustment of contrast adjustment of contrast adjustment of contrast r3 r2 r1 open v3 v2 c0 c1 v1 vdd vss open 1/3 bias (r1 = r2 = r3) r2 r1 open v3 v2 c0 c1 v1 vdd vss open r1 open v3 v2 c0 c1 v1 vdd vss open static keep the following conditon. v dd v 3 v 2 v 1 v ss 1/2 bias (r1 = r2)
page 200 16. lcd driver 16.3 lcd display operation TMP86FS28FG note: ?: this bit is not used for display data 16.3.2 blanking blanking is enabled when edsp is cleared to ?0?. blanking turns off lcd through outputting a gnd level to seg/com pin. when in stop mode, edsp is cleared to ?0? and auto matically blanked. to redisplay icd after exiting stop mode, it is necessary to set edsp back to ?1?. note:during reset, the lcd common outputs are fixed ?0? level. but the multiplex terminal of input/output port and lcd segment output becomes high impedance. therefore, when the reset input is long remarkably, ghost problem may appear in lcd display. table 16-5 lcd display data area (dbr) address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 0fc0h seg1 seg0 0fc1h seg3 seg2 0fc2h seg5 seg4 0fc3h seg7 seg6 0fc4h seg9 seg8 0fc5h seg11 seg10 0fc6h seg13 seg12 0fc7h seg15 seg14 0fc8h seg17 seg16 0fc9h seg19 seg18 0fcah seg21 seg20 0fcbh seg23 seg22 0fcch seg25 seg24 0fcdh seg27 seg26 0fceh seg29 seg28 0fcfh seg31 seg30 0fd0h seg33 seg32 0fd1h seg35 seg34 0fd2h seg37 seg36 0fd3h seg39 seg38 com3 com2 com1 com0 com3 com2 com1 com0
page 201 TMP86FS28FG 16.4 control method of lcd driver 16.4.1 initial setting figure 16-5 shows the flowchart of initialization. figure 16-5 initial se tting of lcd driver 16.4.2 store of display data generally, display data are prepared as fixed data in program memory (rom) and stored in display data area by load command. example : to operate a 1/4 duty lcd of 40 segments u 4 com-mons at fr ame frequency fc/2 16 [hz], and booster fre- quency fc/2 13 [hz] ld (lcdcr), 01000001b ; sets lcd driving method and frame frequency. boost frequency ld (p*lcr), 0ffh ; sets segment output control register. (*; port no.) : : : : ; sets the initial value of display data. ld (lcdcr), 11000001b ; display enable sets lcd driving method (duty). sets frame frequency (slf). sets segment output control registers (p*lcr (*; port no.)) initialization of display data area. display enable (edsp) (releases from blanking.) sets boost frequency (vfsel). enables booster circuit (bres)
page 202 16. lcd driver 16.4 control method of lcd driver TMP86FS28FG note:db is a byte data difinition instruction. figure 16-6 example of com, seg pin connection (1/4 duty) example :to display using 1/4 duty lcd a numerical value wh ich corresponds to the lcd data stored in data mem- ory at address 80h (when pins com and seg are conn ected to lcd as in figure 16-6), display data become as shown in table 16-6. ld a, (80h) add a, table-$-7 ld hl, 0f80h ld w, (pc + a) ld (hl), w ret table: db 11011111b, 00000110b, 11100011b, 10100111b, 00110110b, 10110101b, 11110101b, 00010111b, 11110111b, 10110111b table 16-6 example of display data (1/4 duty) no. display display data no. display display data 0 11011111 5 101 10101 1 00000110 6 11110101 2 11100011 7 00000111 3 10100111 8 11110111 4 00110110 9 10110111 seg0 seg1 com0 com1 com2 com3
page 203 TMP86FS28FG example 2: table 16-6 shows an example of display data which are displayed using 1/2 duty lcd in the same way as table 16-7. the connection between pins com and seg are the same as shown in figure 16-7. figure 16-7 example of com, seg pin connection note: *: don?t care table 16-7 example of display data (1/2 duty) number display data number display data high order address low order address high order address low order address 0 **01**11 **01**11 5 **11**10 **01**01 1 **00**10 **00**10 6 **11**11 **01**01 2 **10**01 **01**11 7 **01**10 **00**11 3 **10**10 **01**11 8 **11**11 **01**11 4 **11**10 **00**10 9 **11**10 **01**11 seg0 seg2 seg1 seg3 com0 com1
page 204 16. lcd driver 16.4 control method of lcd driver TMP86FS28FG 16.4.3 example of lcd drive output figure 16-8 1/4 duty (1/3 bias) drive v lcd3 0 v lcd3 0 v lcd3 0 v lcd3 0 v lcd3 0 v lcd3 0 v lcd3 ? v lcd3 v lcd3 0 0 ? v lcd3 seg0 seg1 display data area address seg0 edsp seg1 com0 com1 com2 com3 com0-seg0 (selected) com2-seg1 (non selected) 1011 0101 com0 com1 com2 com3 0fc0h
page 205 TMP86FS28FG figure 16-9 1/3 duty (1/3 bias) drive seg2 address *: don?t care seg0 edsp seg1 seg2 com0 com1 com2 com0-seg1 (selected) com1-seg2 (non selected) seg1 seg0 com0 com1 com2 display data area *111 *010 **** *001 v lcd3 0 v lcd3 0 v lcd3 0 v lcd3 0 v lcd3 0 v lcd3 0 v lcd3 ? v lcd3 v lcd3 0 0 ? v lcd3 0fc0h 0fc1h
page 206 16. lcd driver 16.4 control method of lcd driver TMP86FS28FG figure 16-10 1/2 duty (1/2 bias) drive address *: don?t care seg0 edsp seg1 seg2 com0 com1 com0-seg1 (selected) com1-seg2 (non selected) display data area **01 **01 **11 **10 v lcd3 0 vlcd3 0 vlcd3 0 vlcd3 0 vlcd3 0 vlcd3 0 vlcd3 0 ? v lcd3 seg3 vlcd3 0 com0 com2 com1 seg3 com0 com1 ? v lcd3 0fc0h 0fc1h
page 207 TMP86FS28FG figure 16-11 static drive seg2 seg7 address seg5 seg4 seg3 seg0 seg1 seg6 com0 v lcd3 v lcd3 0 v lcd3 0 v lcd3 v lcd3 ? v lcd3 v lcd3 0 seg0 seg4 seg7 com0 com0-seg0 (selected) com0-seg4 (non selected) 0 ? v lcd3 edsp ***0 ***1 ***1 ***1 ***1 ***0 ***0 ***1 display data area *: don?t care 0 0 0fc0h 0fc1h 0fc2h 0fc3h
page 208 16. lcd driver 16.4 control method of lcd driver TMP86FS28FG
page 209 TMP86FS28FG 17. flash memory TMP86FS28FG has 61440byte flash memory (address: 1000h to ffffh). the write and erase operations to the flash memory are controlled in th e following three types of mode. - mcu mode the flash memory is accessed by the cpu control in the mcu mode. this mode is used for software bug correction and firmware change after shipment of the device since the write operation to the flash memory is available by retaining the application behavior. - serial prom mode the flash memory is accessed by the cpu control in th e serial prom mode. use of the serial interface (uart) enables the flash memory to be controlled by the small number of pins. TMP86FS28FG in the serial prom mode supports on-board programming wh ich enables users to prog ram flash memory after the microcontroller is mounted on a user board. - parallel prom mode the parallel prom mode allows the flash memory to be accessed as a stand-alone flash memory by the program writer provided by the third party. high-speed access to th e flash memory is available by control- ling address and data signals directly. for the suppor t of the program writer, please ask toshiba sales rep- resentative. in the mcu and serial prom modes, the flash memory c ontrol register (flscr) is used for flash memory con- trol. this chapter describes how to acce ss the flash memory using the flash memo ry control register (flscr) in the mcu and serial prom modes.
page 210 17. flash memory 17.1 flash memory control TMP86FS28FG 17.1 flash memory control the flash memory is controlled via the flash memory control register (flscr) and flash memory stanby control resister (flsstb). note 1: the command sequence of the flash me mory can be executed only when flsmd=" 0011b". in other cases, any attempts to execute the command sequence are ineffective. note 2: flsmd must be set to either "1100b" or "0011b". note 3: banksel is effective only in the serial prom mode. in t he mcu mode, the flash memory is always accessed with actual addresses (1000-ffffh) regardless of banksel. note 4: bits 2 through 0 in flscr are always read as don?t care. note 1: when fstb is set to 1, do not execute the read/write in struction to the flash memory bec ause there is a possibility that the expected data is not read or the program is not operated correctl y. if executing the read/write instruction, fstb is initial- ized to 0 automatically. note 2: if an interrupt is issued when fstb is set to 1, fstb is initialized to 0 automatically and then the vector area of the flash memory is read. note 3: if the idle0/1/2, sleep0/1/2 or stop mode is activated when fstb is set to 1, fstb is initialized to 0 automatically. in the idle0/1/2, sleep0/1/2 or stop mode, the standby function operates regardless of fstb setting. 17.1.1 flash memory command sequenc e execution control (flscr) the flash memory can be protected fr om inadvertent write due to program error or microcontroller misoper- ation. this write protection feature is realized by disabling flash memo ry command sequence execution via the flash memory control register (write protect). to enable command sequence execution, set flscr to ?0011b?. to disable comman d sequence execution, set flscr to ?1100b?. after reset, flscr is initialized to ?1100b? to disable command sequence execution. normally, flscr should be set to ?1100b? except when the flash memory needs to be written or erased. 17.1.2 flash memory bank se lect control (flscr) in the serial prom mode, a 2-kbyte bootrom is ma pped to addresses 7800h-7fffh and the flash mem- ory is mapped to 2 banks at 8000h-ffffh. flash memory addresses 1000h-7fffh are mapped to 9000h- ffffh as bank0, and flash memory addresses 800 0h-ffffh are mapped to 8000h-ffffh as bank1. flscr is used to switch between these banks . for example, to access the flash memory address 7000h, set flscr to ?0? and then access f0 00h. to access the flash memory address 9000h, set flscr to ?1 " and then access 9000h. in the mcu mode, the flash memory is accessed with actual addresses at 1000h-ffffh. in this case, flscr is ineffective (i.e., its value has no effect on other operations). flash memory control register flscr76543210 (0fafh) flsmd banksel (initial value : 1100 1***) flsmd flash memory command sequence exe- cution control 1100: disable command sequence execution 0011: enable command sequence execution others: reserved r/w banksel flash memory bank select control (serial prom mode only) 0: select bank0 1: select bank1 r/w flash memory standby control register flsstb76543210 (0fadh) fstb (initial value : **** ***0) fstb flash memory standby control 0: disable the standby function. 1: enable the standby function. write only
page 211 TMP86FS28FG 17.1.3 flash memory stan dby control (flsstb) low power consumption is enabled by cutting off the steady-state current of the flash memory. in the idle0/1/2, sleep0/1/2 or stop mode, th e steady-state current of the flas h memory is cut off automatically. when the program is executed in the ram area (with out accessing the flash me mory) in the normal 1/2 or slow1/2 mode, the current can be cut off by the contro l of the register. to cut off the steady-state current of the flash memory, set flsstb to ?1? by the c ontrol program in the ram area. the procedures for controlling the flsstb regi ster are explained below. (steps1 and 2 are controlled by the program in the flash memory, and steps 3 through 8 are controlled by the write control program ex ecuted in the ram area.) 1. transfer the control program of th e flsstb register to the ram area. 2. jump to the ram area. 3. disable (di) the interrupt mast er enable flag (imf = ?0?). 4. set flsstb to ?1?. 5. execute the user program. 6. repeat step 5 until the return requ est to the flash memory is detected. 7. set flsstb to ?0?. 8. jump to the flash memory area. note 1: the standby function is not operated by setting fl sstb with the program in the flash memory. you must set flsstb by the program in the ram area. note 2: to use the standby function by setting flsstb to ?1? with the program in the ram area, flsstb must be set to ?0? by the program in the ram area before returning the program control to the flash memory. if the program control is returned to the flash memory with flsstb set to ?1?, the program may misoperate and run out of control. table 17-1 flash memory access operating mode flscr access area specified address mcu mode don?t care 1000h-ffffh serial prom mode 0 (bank0) 1000h-7fffh 9000h-ffffh 1 (bank1) 8000h-ffffh
page 212 17. flash memory 17.2 command sequence TMP86FS28FG 17.2 command sequence the command sequence in the mcu and the serial prom modes consists of six commands (jedec compatible), as shown in table 17-2. addresses specified in the command sequence are recogni zed with the lower 12 bits (excluding ba, sa, and ff7fh used for read protection). the upper 4 bits are used to specify the flash memory area, as shown in table 17-3. note 1: set the address and data to be written. note 2: the area to be erased is specified with the upper 4 bits of the address. 17.2.1 byte program this command writes the fl ash memory for each byte unit. the addresse s and data to be written are specified in the 4th bus write cycle. each byte can be programmed in a maximum of 40 p s. the next command sequence cannot be executed until the write operation is completed. to check the completion of the write operation, per- form read operations repeat edly until the same data is read twice fr om the same address in the flash memory. during the write operation, any consecutive attempts to r ead from the same address is reversed bit 6 of the data (toggling between 0 and 1). note:to rewrite data to flash memory addresses at which dat a (including ffh) is already written, make sure to erase the existing data by "sector erase" or "chip erase" before rewriting data. 17.2.2 sector erase (4-kbyte erase) this command erases the flash memory in units of 4 k bytes. the flash memory area to be erased is specified by the upper 4 bits of the 6th bus write cycle address. for example, in the mcu mode, to erase 4 kbytes from 7000h to 7fffh, specify one of the addresses in 7000h-7fffh as the 6th bus write cycle. in the serial prom mode, to erase 4 kbytes from 7000h to 7fffh, set flscr to "0" and then specify one of the addresses in f000h-ffffh as the 6th bus write cycle. the sector erase command is effective only in the mcu and serial prom modes, and it cannot be used in the parallel prom mode. table 17-2 command sequence command sequence 1st bus write cycle 2nd bus write cycle 3rd bus write cycle 4th bus write cycle 5th bus write cycle 6th bus write cycle address data address data address data address data address data address data 1 byte program 555h aah aaah 55h 555h a0h ba (note 1) data (note 1) ---- 2 sector erase (4-kbyte erase) 555h aah aaah 55h 555h 80h 555h aah aaah 55h sa (note 2) 30h 3 chip erase (all erase) 555h aah aaah 55h 555h 80h 555h aah aaah 55h 555h 10h 4product id entry555haahaaah55h555h90h------ 5 product id exitxxhf0h---------- product id exit555haahaaah55h555hf0h------ 6read protect555haahaaah55h555ha5hff7fh00h---- table 17-3 address specification in the command sequence operating mode flscr specified address mcu mode don?t care 1***h-f***h serial prom mode 0 (bank0) 9***h-f***h 1 (bank1) 8***h-f***h
page 213 TMP86FS28FG a maximum of 30 ms is required to erase 4 kbytes. the next command sequence cannot be executed until the erase operation is completed. to check the completion of the erase operation, perf orm read operations repeat- edly for data polling until the same data is read twice from the same address in the flash memory. during the erase operation, any consecutive attempts to read from the same address is reversed bit 6 of the data (toggling between 0 and 1). 17.2.3 chip erase (all erase) this command erases the entire flash memory in appr oximately 30 ms. the next command sequence cannot be executed until the erase operation is completed. to check the completio n of the erase operation, perform read operations repeatedly for data polling until the same data is read twice from the same address in the flash memory. during the erase operation, any consecutive attemp ts to read from the same address is reversed bit 6 of the data (toggling between 0 and 1). after the chip is erased, all bytes contain ffh. 17.2.4 product id entry this command activates the product id mode. in the product id mode, the vendor id, the flash id, and the read protection status can be read from the flash memory. note: the value at address f002h (flash size) depends on the size of flash memory incorporated in each product. for example, if the product has 60-kbyte flash memory, "0eh" is read from address f002h. 17.2.5 product id exit this command is used to exit the product id mode. 17.2.6 read protect this command enables the r ead protection setting in the flash memory . when the read protection is enabled, the flash memory cannot be read in the parallel prom mode. in the serial prom mode, the flash write com- mand cannot be executed. to enable the read protection set ting in the serial prom mode, set flscr to "1" before exe- cuting the read protect comman d sequence. to disable the read protection setting, it is necessary to execute the chip erase command sequence. whethe r or not the read protection is en abled can be checked by reading ff7fh in the product id mode. for details, see table 17-4. table 17-4 values to be read in the product id mode address meaning read value f000h vendor id 98h f001h flash macro id 41h f002h flash size 0eh: 60 kbytes 0bh: 48 kbytes 07h: 32 kbytes 05h: 24 kbytes 03h: 16 kbytes 01h: 8 kbytes 00h: 4 kbytes ff7fh read protection status ffh: read protection disabled other than ffh: read protection enabled
page 214 17. flash memory 17.3 toggle bit (d6) TMP86FS28FG it takes a maximum of 40 p s to set read protection in the flash memory. the next command sequence cannot be executed until this operation is completed. to check the completion of the read protect operation, perform read operations repeatedly for data polling until the same data is read twice from the same address in the flash memory. during the read protect operation, any attempts to read from the same address is reversed bit 6 of the data (toggling between 0 and 1). 17.3 toggle bit (d6) after the byte program, chip erase, and read protect command sequence is executed, any consecutive attempts to read from the same address is reversed bit 6 (d6) of the data (toggling between 0 and 1) until the operation is com- pleted. therefore, this toggle bit provides a software mechanism to check the completion of each operation. usually perform read operations repeatedly for data polling until th e same data is read twice from the same address in the flash memory. after the byte program, chip erase, or read protect command sequence is executed, the initial read of the toggle bit always produces a "1".
page 215 TMP86FS28FG 17.4 access to the flash memory area when the write, erase and read protect ions are set in the flash memory, read and fetch operations cannot be per- formed in the entire flash memory area. therefore, to perform these operations in the entire flash memory area, access to the flash memory area by the control program in the bootrom or ram area. (the flash memory pro- gram cannot write to the flash memory.) the serial prom or mcu mode is used to run the control program in the bootrom or ram area. note 1: the flash memory can be written or read for each by te unit. erase operations can be performed either in the entire area or in units of 4 kbytes, whereas read operations can be performed by an one transfer instruction. however, the command sequence method is adopted for write and erase operations, requiring several-byte transfer instruc- tions for each operation. note 2: to rewrite data to flash memory addresses at which data (including ffh) is already written, make sure to erase the existing data by "sector erase" or "chip erase" before rewriting data. 17.4.1 flash memory contro l in the serial prom mode the serial prom mode is used to access to the fl ash memory by the contro l program provided in the bootrom area. since almost of all op erations relating to access to the flash memory can be controlled sim- ply by the communication data of th e serial interface (uart), these functio ns are transparent to the user. for the details of the serial prom mode, see ?serial prom mode.?
page 216 17. flash memory 17.4 access to the flash memory area TMP86FS28FG 17.4.2 flash memory c ontrol in the mcu mode in the mcu mode, write operations are performed by executing the control program in the ram area. before execution of the control pr ogram, copy the control program into the ram area or obtain it from the external using the communication pin. the procedures to execute the cont rol program in the ram area in the mcu mode are described below. 17.4.2.1 how to write to the flash memory by executing a user write control program in the ram area (in the mcu mode) (steps 1 and 2 are controlled by the program in the flash memory, and steps 3 through 11 are controlled by the control program in the ram area.) 1. transfer the write contro l program to the ram area. 2. jump to the ram area. 3. disable (di) the interrup t master enable flag (imf m "0"). 4. disable the watchdog timer, if it is used. 5. set flscr to "0011b" (to enable command sequence execution). 6. execute the erase command sequence. 7. read the same flash memory address twice. (repeat step 7 until the same data is read by two consecutive read operations.) 8. execute the write command sequence. (it is no t required to specify the bank to be written.) 9. read the same flash memory address twice. (repeat step 9 until the same data is read by two consecutive read operations.) 10. set flscr to "1100b" (to disable command sequence execution). 11. jump to the flash memory area. note 1: before writing to the flash memory in the ram area, disable interrupts by setting the interrupt master enable flag (imf) to "0". usually disable interrupts by executing the di instruction at the head of the write control program in the ram area. note 2: when writing to the flash memory, do not in tentionally use non-maskable interrupts (the watchdog timer must be disabled if it is used). if a non-mask able interrupt occurs while the flash memory is being written, unexpected data is read from the flash memory (interrupt vector), resulting in malfunc- tion of the microcontroller.
page 217 TMP86FS28FG example :after sector eras ure (e000h-efffh), the program in the ram area writes data 3fh to address e000h. di : disable interrupts (imf m "0") ld (wdtcr2),4eh : clear the wdt binary counter. ldw (wdtcr1),0b101h : disable the wdt. ld (flscr),0011_1000b : enable command sequence execution. ld ix,0f555h ld iy,0faaah ld hl,0e000h ; #### flash memory sector erase process #### ld (ix),0aah : 1st bus write cycle ld (iy),55h : 2nd bus write cycle ld (ix),80h : 3rd bus write cycle ld (ix),0aah : 4th bus write cycle ld (iy),55h : 5th bus write cycle ld (hl),30h : 6th bus write cycle sloop1: ld w,(ix) cmp w,(ix) jr nz,sloop1 : loop until the same value is read. ; #### flash memory write process #### ld (ix),0aah : 1st bus write cycle ld (iy),55h : 2nd bus write cycle ld (ix),0a0h : 3rd bus write cycle ld (hl),3fh : 4th bus write cycle, (1000h)=3fh sloop2: ld w,(hl) cmp w,(hl) jr nz,sloop2 : loop until the same value is read. ld (flscr),1100_1000b : disable command sequence execution. jp xxxxh : jump to the flash memory area. example :this write control program reads data from address f000h and stores it to 98h in the ram area. ld a,(0f000h) : read data from address f000h. ld (98h),a : store data to address 98h.
page 218 17. flash memory 17.4 access to the flash memory area TMP86FS28FG
page 219 TMP86FS28FG 18. serial prom mode 18.1 outline the TMP86FS28FG has a 2048 byte bootrom (mask rom) for programming to flash memory. the bootrom is available in the serial prom mode, and controlled by test, boot and reset pins. communica- tion is performed via uart. the serial prom mode has six types of operating mode: flash memory writing, flash memory sum output, product id code output, flash memo ry status output, flash memory erasing and flash mem- ory read protection setting. memory address mapping in the serial prom mode differs from that in the mcu mode. figure 18-1 shows memory address mapping in the serial prom mode. note: TMP86FS28FG doesn?t support ram loader mode. (the ram loader mode can?t be used in TMP86FS28FG.) note: though included in above operating range, some of high fr equencies are not supported in the serial prom mode. for details, refer to ?table 18-5?. 18.2 memory mapping the figure 18-1 shows memory mapping in the serial prom mode and mcu mode. in the serial prom mode, the bootrom (mask rom) is mapped in addresses from 7800h to 7fffh. the flash memory is divided into two banks for mapping. figure 18-1 figure 18-1 memory address maps table 18-1 operating range in the serial prom mode parameter min max unit power supply 4.5 5.5 v high frequency (note) 2 16 mhz to use the flash memory writing command (30h), specify th e flash memory addresses fr om 1000h to ffffh, that is the same addresses in the mcu mode, because the bootrom changes the flash memory address. 003fh 0000h 64 bytes 2048 bytes 0040h 0fffh 7800h 7fffh 8000h 8000h 7fffh ffffh ffffh sfr ram dbr sfr ram dbr bootrom flash memory serial prom mode mcu mode 9000h 28672 bytes (bank0) 32768 bytes (bank1) 61440 bytes 003fh 0000h 64 bytes 0040h 0fffh 1000h flash memory 2048 bytes 256 bytes 256 bytes 083fh 0f00h 0f00h 2048 bytes 083fh
page 220 18. serial prom mode 18.3 serial prom mode setting TMP86FS28FG 18.3 serial prom mode setting 18.3.1 serial prom mode control pins to execute on-board programming, act ivate the serial prom mode. table 18-2 shows pin setting to activate the serial prom mode. note: the boot pin is shared with the uart communication pin (rxd 1 pin) in the serial prom mode. this pin is used as uart communication pin after activating serial prom mode 18.3.2 pin function in the serial prom mode, txd1 (p35) and rxd1 (p34) are used as a serial interface pin. note 1: during on-board programming with other parts mounted on a user board, be careful no to affect these communication control pins. note 2: operating range of high frequency in serial prom mode is 2 mhz to 16 mhz. table 18-2 serial prom mode setting pin setting test pin high boot/rxd1 pin high reset pin table 18-3 pin function in the serial prom mode pin name (serial prom mode) input/ output function pin name (mcu mode) txd1 output serial data output (note 1) p35 boot/rxd1 input/input serial prom mode control/serial data input p34 reset input serial prom mode control reset test input fixed to high test vdd, avdd power supply 4.5 to 5.5 v vss, avss power supply 0 v varef power supply leave open or apply input reference voltage. i/o ports except p35, p34 i/o these ports are in the high-impedance state in the serial prom mode. the input level is fixed to the port inputs with a hardware feature to prevent overlap current. (the port inputs are invalid.) com3 to com0 output low output in the serial prom mode c0,c1,v3 to v1 - connect to a capacitor (resistance), or leave open. xin input self-oscillate with an oscillator. (note 2) xout output
page 221 TMP86FS28FG figure 18-2 serial prom mode pin setting note 1: for connection of other pins, refer to " t able 18-3 pin function in the serial prom mode ". 18.3.3 example connection for on-board writing figure 18-3 shows an example connection to perform on-board wring. figure 18-3 example conn ection for on-board writing note 1: when other parts on the application board effect th e uart communication in the serial prom mode, iso- late these pins by a jumper or switch. note 2: when the reset control circuit on the application board effect s activation of the serial prom mode, isolate the pin by a jumper or switch. note 3: for connection of other pins, refer to " t able 18-3 pin function in the serial prom mode ". vdd(4.5 v to 5.5 v) serial prom mode mcu mode vdd test reset external control pull-up xin xout vss gnd boot / rxd1 (p34) txd1 (p35) TMP86FS28FG vdd(4.5 v to 5.5 v) serial prom mode mcu mode vdd test reset pc control pull-up level converter xin xout vss gnd external control board application board rc power-on reset circuit reset control other parts (note 1) (note 2) boot / rxd1 (p34) txd1 (p35)
page 222 18. serial prom mode 18.3 serial prom mode setting TMP86FS28FG 18.3.4 activating t he serial prom mode the following is a procedure to ac tivate the serial prom mode. " figure 18-4 serial prom mode timing " shows a serial prom mode timing. 1. supply power to the vdd pin. 2. set the reset pin to low. 3. set the test pin and boot/rxd1 pins to high. 4. wait until the power supply and clock oscillation stabilize. 5. set the reset pin to high. 6. input the matching data (5ah) to the boot/rxd1 pin after setup sequence. for details of the setup timing, refer to " 18.15 uart timing ". figure 18-4 serial prom mode timing vdd test(input) reset(input) program setup time for serial prom mode (rxsup) high level setting matching data don't care reset mode serial prom mode input boot/rxd1 (input)
page 223 TMP86FS28FG 18.4 interface specifications for uart the following shows the uart communication format used in the serial prom mode. to perform on-board programming, the communication format of the write controller must also be set in the same manner. the default baud rate is 9600 bps regardless of operating frequency of the microcontroller. the baud rate can be modified by transmitting the baud rate modification data shown in table 1-4 to TMP86FS28FG. the table 18-5 shows an operating frequency and baud rate. the frequencies which are not described in table 18-5 can not be used. - baud rate (default): 9600 bps - data length: 8 bits - parity addition: none - stop bit: 1 bit table 18-4 baud rate modification data baud rate modification data 04h 05h 06h 07h 0ah 18h 28h baud rate (bps) 76800 62500 57600 38400 31250 19200 9600
page 224 18. serial prom mode 18.4 interface specifications for uart TMP86FS28FG note 1: ?ref. frequency? and ?rating? show frequencies availabl e in the serial prom mode. though the frequency is supported in the serial prom mode, the serial prom mode may not be activated correctly due to the frequency difference in the external controller (such as pers onal computer) and oscillator, and load capacitance of communication pins. note 2: it is recommended that the total frequency difference is within r 3% so that auto detection is performed correctly by the ref- erence frequency. note 3: the external controller must transmit the matching dat a (5ah) repeatedly till the auto detection of baud rate is perform ed. this number indicates the number of times t he matching data is transmitted for each frequency. table 18-5 operating frequency and baud rate in the serial prom mode (note 3) reference baud rate (bps) 76800 62500 57600 38400 31250 19200 9600 baud rate modification data 04h 05h 06h 07h 0ah 18h 28h ref. fre- quency (mhz) rating (mhz) baud rate (bps) (%)(bps)(%)(bps)(%)(bps)(%)(bps)(%)(bps)(%)(bps)(%) 1 21.91 to 2.10------------9615+0.16 2 43.82 to 4.19--------312500.0019231+0.169615+0.16 4.193.82 to 4.19--------32734+4.7520144+4.921 0072 +4.92 3 4.91524.70 to 5.16------ 38400 0.00 - - 19200 0.00 9600 0.00 54.70 to 5.16------ 39063 +1.73 - - 19531 +1.73 9766 +1.73 4 65.87 to 6.45------------9375-2.34 6.1445.87 to 6.45------------96000.00 5 7.3728 7.05 to 7.74 - - - 57600 0.00 - - - - 19200 0.00 9600 0.00 6 8 7.64 to 8.39 - - 62500 0.00 - - 38462 +0.16 31250 0.00 19231 +0.16 9615 +0.16 7 9.8304 9.40 to 10.32 76800 0.00 ---- 38400 0.00 - - 19200 0.00 9600 0.00 10 9.40 to 10.32 78125 +1.73 ---- 39063 +1.73 - - 19531 +1.73 9766 +1.73 8 12 11.75 to 12.90 - - - - 57692 +0.16 - - 31250 0.00 18750 -2.34 9375 -2.34 12.288 11.75 to 12.90 - - - - 59077 +2.56 - - 32000 +2.40 19200 0.00 9600 0.00 12.5 11.75 to 12.90 - - 60096 -3.85 60096 +4.33 - - 30048 -3.85 19531 +1.73 9766 +1.73 9 14.7456 14.10 to 15.48 - - - - 57600 0.00 38400 0.00 - - 19200 0.00 9600 0.00 10 16 15.27 to 16.77 76923 +0.16 62500 0.00 - - 38462 +0.16 31250 0.00 19231 +0.16 9615 +0.16
page 225 TMP86FS28FG 18.5 operation command the eight commands shown in table 18-6 are used in the serial prom mode. after reset release, the TMP86FS28FG waits for the matching data (5ah). note 1: TMP86FS28FG doesn?t support ram loader mode. 18.6 operation mode the serial prom mode has six types of modes, that are (1) flash memory erasing, (2) flash memory writing, (3) flash memory sum output, (4) product id code output, (5) flash memory status output and (6) flash memory read protection setting modes. descripti on of each mode is shown below. 1. flash memory erasing mode the flash memory is erased by the chip erase (erasing an entire flash area) or sector erase (erasing sectors in 4-kbyte units). the erased area is filled with ffh. when the read protection is enabled, the sector erase in the flash erasing mode can not be performed. to disabl e the read protection, perfor m the chip erase. before erasing the flash memory, tmp86fs28f g checks the passwords except a blank product. if the password is not matched, the flash memory erasing mode is not activated. 2. flash memory writing mode data is written to the specified flas h memory address for each byte unit. the external controller must trans- mit the write data in the intel hex format (binary). if no error is encountered till the end record, TMP86FS28FG calculates the checksum for the entire flash memory area (1000h to ffffh), and returns the obtained result to the external controller. when the read protection is enabled, the flash memory writing mode is not activated. in this case, perform the chip erase command beforehand in the flash memory eras- ing mode. before activating the flash memory writ ing mode, TMP86FS28FG ch ecks the password except a blank product. if the password is not matched, flash memory writing mode is not activated. 3. flash memory sum output mode the checksum is calculated for the entire flash memory area (1000h to ffffh), and the result is returned to the external controller. since the bootrom does not support the oper ation command to read the flash memory, use this checksum to identify programs when managing revisions of application programs. 4. product id code output the code used to identify the product is output. the code to be output consists of 13-byte data, which includes the information indicating th e area of the rom incorporated in the product. the external control- ler reads this code, and recognizes the product to write. (in the case of TMP86FS28FG, the addresses from 1000h to ffffh become the rom area.) 5. flash memory status output mode the status of the area from ffe0h to ffffh, and the read protection co ndition are output as 7-byte code. the external controller reads this code to recognize the flash memory status. 6. flash memory read protection setting mode this mode disables reading the flash memory data in parallel prom mode. in the serial prom mode, the flash memory writing mode is disabled. to disable the flash memory read prot ection, perform the chip erase in the flash memory erasing mode. table 18-6 operation command in the serial prom mode command data operating mode description 5ah setup matching data. execute this command after releasing the reset. f0h flash memory erasing erases the flas h memory area (address 1000h to ffffh). 30h flash memory writing writes to the flash memory area (address 1000h to ffffh). 90h flash memory sum output outputs the 2-byte checksum upper byte and lower byte in this order for the entire area of the flash memory (address 1000h to ffffh). c0h product id code output outputs the product id code (13-byte data). c3h flash memory status output outputs the status code (7-byte data) such as the read protection condition. fah flash memory read protection setting enables the read protection.
page 226 18. serial prom mode 18.6 operation mode TMP86FS28FG 18.6.1 flash memory erasi ng mode (operati ng command: f0h) table 18-7 shows the flash memory erasing mode. note 1: ?xxh u 3? indicates that the device enters the halt condition after transmitting 3 bytes of xxh. note 2: refer to " 18.13 specifying the erasure area ". note 3: refer to " 18.8 checksum (sum) ". note 4: refer to " 18.10 passwords ". note 5: do not transmit the password string for a blank product. note 6: when a password error occurs, TMP86FS28FG stops ua rt communication and enters the halt mode. therefore, when a password error occurs, initialize TMP86FS28FG by the reset pin and reactivate the serial prom mode. note 7: if an error occurs during transfer of a password addres s or a password string, TMP86FS28FG stops uart communica- tion and enters the halt condition. therefore, when a pa ssword error occurs, initialize TMP86FS28FG by the reset pin and reactivate the serial prom mode. description of the flash memory erasing mode 1. the 1st through 4th bytes of the transmitted and r eceived data contain the same data as in the flash memory writing mode. table 18-7 flash memory erasing mode transfer byte transfer data from the external controller to TMP86FS28FG baud rate transfer data from TMP86FS28FG to the external controller boot rom 1st byte 2nd byte matching data (5ah) - 9600 bps 9600 bps - (automatic baud rate adjustment) ok: echo back data (5ah) error: no data transmitted 3rd byte 4th byte baud rate change data (table 18-4) - 9600 bps 9600 bps - ok: echo back data error: a1h u 3, a3h u 3, 62h u 3 (note 1) 5th byte 6th byte operation command data (f0h) - modified baud rate modified baud rate - ok: echo back data (f0h) error: a1h u 3, a3h u 3, 63h u 3 (note 1) 7th byte 8th byte password count storage address bit 15 to 08 (note 4, 5) modified baud rate modified baud rate - ok: nothing transmitted error: nothing transmitted 9th byte 10th byte password count storage address bit 07 to 00 (note 4, 5) modified baud rate modified baud rate - ok: nothing transmitted error: nothing transmitted 11th byte 12th byte password comparison start address bit 15 to 08 (note 4, 5) modified baud rate modified baud rate - ok: nothing transmitted error: nothing transmitted 13th byte 14th byte password comparison start address bit 07 to 00 (note 4, 5) modified baud rate modified baud rate - ok: nothing transmitted error: nothing transmitted) 15th byte : m?th byte password string (note 4, 5) - modified baud rate modified baud rate - ok: nothing transmitted error: nothing transmitted n?th - 2 byte erase area specification (note 2) modified baud rate - n?th - 1 byte - modified baud rate ok: checksum (upper byte) (note 3) error: nothing transmitted n?th byte - modified baud rate ok: checksum (lower byte) (note 3) error: nothing transmitted n?th + 1 byte (wait for the next operation command data) modified baud rate -
page 227 TMP86FS28FG 2. the 5th byte of the received data contains th e command data in the flash memory erasing mode (f0h). 3. when the 5th byte of the receive d data contains the operation command data shown in table 18-6, the device echoes back the value which is the same data in the 6th byte position of the received data (in this case, f0h). if the 5th byte of the received data does not contai n the operation command data, the device enters the halt condition after sending 3 bytes of the operation command error code (63h). 4. the 7th thorough m'th bytes of the transmitted and received data contai n the same data as in the flash memory writing mode. in the case of a blank produc t, do not transmit a password string. (do not transmit a dummy password string.) 5. the n?th - 2 byte contains the erasure area specification data. the upper 4 bits and lower 4 bits specify the start address and end address of the erasure area, respectively. for the detailed description, see ?1.13 specifying the erasure area?. 6. the n?th - 1 byte and n?th byte contain the upper and lower bytes of the checksum, respectively. for how to calculate the checksum, refer to ?1.8 checksum (sum)?. checksum is calculated unless a receiving error or intel hex format error occurs. after sending the e nd record, the external controller judges whether the transmission is completed corr ectly by receiving the checksum sent by the device. 7. after sending the checksum, the device waits for the next operation command data.
page 228 18. serial prom mode 18.6 operation mode TMP86FS28FG 18.6.2 flash memory writing mode (operation command: 30h) table 18-8 shows flash memory writing mode process. note 1: ?xxh u 3? indicates that the device enters the halt condition after sending 3 bytes of xxh. for details, refer to " 18.7 error code ". note 2: refer to " 18.9 intel hex format (binary) ". note 3: refer to " 18.8 checksum (sum) ". note 4: refer to " 18.10 passwords ". note 5: if addresses from ffe0h to ffffh are filled with ?ffh?, the passwords are not compared because the device is consid- ered as a blank product. transmitting a password string is not requi red. even in the case of a blank product , it is required to specify the password count storage address and the password comparison start address. transmit these data from the external controller. if a password error occurs due to incorr ect password count storage address or password comparison start address, TMP86FS28FG stops uart communication and enters the halt condition. therefore, when a password error occurs, initialize TMP86FS28FG by the reset pin and reactivate the serial rom mode. note 6: if the read protection is enabled or a password erro r occurs, TMP86FS28FG stops ua rt communication and enters the halt confition. in this case, initialize TMP86FS28FG by the reset pin and reactivate the serial rom mode. note 7: if an error occurs during the reception of a password address or a password string, TMP86FS28FG stops uart commu- nication and enters the halt condition. in th is case, initialize TMP86FS28FG by the reset pin and reactivate the serial prom mode. table 18-8 flash memory writing mode process transfer byte transfer data from external controller to TMP86FS28FG baud rate transfer data from TMP86FS28FG to external controller boot rom 1st byte 2nd byte matching data (5ah) - 9600 bps 9600 bps - (automatic baud rate adjustment) ok: echo back data (5ah) error: nothing transmitted 3rd byte 4th byte baud rate modification data (see table 18-4) - 9600 bps 9600 bps - ok: echo back data error: a1h u 3, a3h u 3, 62h u 3 (note 1) 5th byte 6th byte operation command data (30h) - modified baud rate modified baud rate - ok: echo back data (30h) error: a1h u 3, a3h u 3, 63h u 3 (note 1) 7th byte 8th byte password count storage address bit 15 to 08 (note 4) modified baud rate - ok: nothing transmitted error: nothing transmitted 9th byte 10th byte password count storage address bit 07 to 00 (note 4) modified baud rate - ok: nothing transmitted error: nothing transmitted 11th byte 12th byte password comparison start address bit 15 to 08 (note 4) modified baud rate - ok: nothing transmitted error: nothing transmitted 13th byte 14th byte password comparison start address bit 07 to 00 (note 4) modified baud rate - ok: nothing transmitted error: nothing transmitted) 15th byte : m?th byte password string (note 5) - modified baud rate - ok: nothing transmitted error: nothing transmitted m?th + 1 byte : n?th - 2 byte intel hex format (binary) (note 2) modified baud rate - - n?th - 1 byte - modified baud rate ok: sum (upper byte) (note 3) error: nothing transmitted n?th byte - modified baud rate ok: sum (lower byte) (note 3) error: nothing transmitted n?th + 1 byte (wait state for the next operation com- mand data) modified baud rate -
page 229 TMP86FS28FG description of the flash memory writing mode 1. the 1st byte of the received data contains the ma tching data. when the serial prom mode is acti- vated, TMP86FS28FG (hereafter cal led device), waits to receive th e matching data (5ah). upon reception of the matching data, the device automatically adjusts the uart?s initial baud rate to 9600 bps. 2. when receiving the matching data (5ah), the device transmits an ech o back data (5ah) as the second byte data to the external controller. if the devi ce can not recognize the matching data, it does not transmit the echo back data and waits for the matc hing data again with automatic baud rate adjust- ment. therefore, the external cont roller should transmit the matching data repeatedly till the device transmits an echo back data. the transmission repe tition count varies depending on the frequency of device. for details, refer to table 18-5. 3. the 3rd byte of the received data contains the baud ra te modification data. the five types of baud rate modification data shown in table 18-4 are available. even if baud rate is not modified, the external controller should transmit the initial baud rate data (28h: 9600 bps). 4. only when the 3rd byte of the received data contai ns the baud rate modificat ion data corresponding to the device's operating frequency, th e device echoes back data the valu e which is the same data in the 4th byte position of the received data. after the ech o back data is transmitted, baud rate modification becomes effective. if the 3rd byte of the received data does not co ntain the baud rate modification data, the device enters the halts condition after se nding 3 bytes of baud rate modification error code (62h). 5. the 5th byte of the received data contains the command data (30h) to write the flash memory. 6. when the 5th byte of the received data contains the operation command data shown in table 1-6, the device echoes back the value which is the same data in the 6th byte position of the received data (in this case, 30h). if the 5th byte of the received da ta does not contain the op eration command data, the device enters the halt condition after sending 3 bytes of the operation command error code (63h). 7. the 7th byte contains the data for 15 to 8 bits of the password count storage address. when the data received with the 7th byte has no receiving error, the device does not send any data. if a receiving error or password error occurs, the device does not send any data and enters the halt condition. 8. the 9th byte contains the data for 7 to 0 bits of the password count storage address. when the data received with the 9th byte has no receiving error, the device does not send any data. if a receiving error or password error occurs, the device does not send any data and enters the halt condition. 9. the 11th byte contains the data for 15 to 8 bits of the password comparison start address. when the data received with the 11th byte has no receiving erro r, the device does not send any data. if a receiv- ing error or password error occurs, the device does not send any data and enters the halt condition. 10. the 13th byte contains the data for 7 to 0 bits of the password comparison start address. when the data received with the 13th byte ha s no receiving error, the device does not send any data. if a receiv- ing error or password error occurs, the device does not send any data and enters the halt condition. 11. the 15th through m?th bytes contain the passwor d data. the number of passwords becomes the data (n) stored in the password count storage address. the external password data is compared with n- byte data from the address specified by the passwor d comparison start addre ss. the external control- ler should send n-byte password data to the device. if the passwords do not match, the device enters the halt condition without returning an error code to the external controller . if the addresses from ffe0h to ffffh are filled with ?f fh?, the passwords are not conpare d because the device is consid- ered as a blank product. 12. the m?th + 1 through n?th - 2 bytes of the receive d data contain the binary data in the intel hex for- mat. no received data is echoed back to the extern al controller. after receiv ing the start mark (3ah for ?:?) in the intel hex format, the device starts data record reception. ther efore, the received data except 3ah is ignored until the start mark is received. afte r receiving the start mark, the device receives the data record, that consists of data lengt h, address, reco rd type, write data and checksum. since the device starts checksum cal culation after receiving an end r ecord, the external controller should wait for the checksum afte r sending the end record. if a recei ving error or intel hex format error occurs, the device enters the halts condition without returning an error code to the external con- troller. 13. the n?th - 1 and n?th bytes contain the checksum upper and lower bytes. for details on how to calcu- late the sum, refer to " 18.8 checksum (sum) ". the checksum is calculated only when the end record is detected and no receivi ng error or intel hex format er ror occurs. after sending the end
page 230 18. serial prom mode 18.6 operation mode TMP86FS28FG record, the external controller ju dges whether the transmission is co mpleted correctly by receiving the checksum sent by the device. 14. after transmitting the checksu m, the device waits for the next operation command data. note 1: do not write only the address from ffe0h to ffffh when all flash memory data is the same. if only these area are written, the subsequent operation can not be executed due to password error. note 2: to rewrite data to flash memory addresses at whic h data (including ffh) is already written, make sure to erase the existing data by "sector erase" or "chip erase" before rewriting data.
page 231 TMP86FS28FG 18.6.3 flash memory sum out put mode (operati on command: 90h) table 18-9 shows flash memory sum output mode process. note 1: ?xxh u 3? indicates that the device enters the halt condition after sending 3 bytes of xxh. for details, refer to " 18.7 error code ". note 2: refer to " 18.8 checksum (sum) ". description of the flash memory sum output mode 1. the 1st through 4th bytes of the transmitted and recei ved data contains the same data as in the flash memory writing mode. 2. the 5th byte of the received data contains the command data in the flash memory sum output mode (90h). 3. when the 5th byte of the received data contains the operation command data shown in table 1-6, the device echoes back the value which is the same data in the 6th byte position of the received data (in this case, 90h). if the 5th byte of the received da ta does not contain the op eration command data, the device enters the halt condition after transmitting 3 bytes of operation command error code (63h). 4. the 7th and the 8th bytes contain the upper and lowe r bits of the checksum, respectively. for how to calculate the checksum, refer to " 18.8 checksum (sum) ". 5. after sending the checksum, the device waits for the next operation command data. table 18-9 flash memory sum output process transfer bytes transfer data from external control- ler to TMP86FS28FG baud rate transfer data from TMP86FS28FG to external controller boot rom 1st byte 2nd byte matching data (5ah) - 9600 bps 9600 bps - (automatic baud rate adjustment) ok: echo back data (5ah) error: nothing transmitted 3rd byte 4th byte baud rate modification data (see table 18-4) - 9600 bps 9600 bps - ok: echo back data error: a1h u 3, a3h u 3, 62h u 3 (note 1) 5th byte 6th byte operation command data (90h) - modified baud rate modified baud rate - ok: echo back data (90h) error: a1h u 3, a3h u 3, 63h u 3 (note 1) 7th byte - modified baud rate ok: sum (upper byte) (note 2) error: nothing transmitted 8th byte - modified baud rate ok: sum (lower byte) (note 2) error: nothing transmitted 9th byte (wait for the next operation com- mand data) modified baud rate -
page 232 18. serial prom mode 18.6 operation mode TMP86FS28FG 18.6.4 product id code output mode (operation command: c0h) table 18-10 shows product id code output mode process. note: ?xxh u 3? indicates that the device enters th e halt condition after sending 3 bytes of xxh. for details, refer to " 18.7 error code ". description of product id code output mode 1. the 1st through 4th bytes of the transmitted and r eceived data contain the same data as in the flash memory writing mode. 2. the 5th byte of the received data contains the product id code output mode command data (c0h). 3. when the 5th byte contains the operation command data shown in table 18-6, the device echoes back the value which is the same data in the 6th byte positio n of the received data (i n this case, c0h). if the 5th byte data does not contain the operation command data, the device enters the halt condition after sending 3 bytes of operation command error code (63h). 4. the 9th through 19th bytes contain the product id code. for details, refer to " 18.11 product id code ". table 18-10 product id code output process transfer bytes transfer data from external controller to TMP86FS28FG baud rate transfer data from TMP86FS28FG to external controller boot rom 1st byte 2nd byte matching data (5ah) - 9600 bps 9600 bps - (automatic baud rate adjustment) ok: echo back data (5ah) error: nothing transmitted 3rd byte 4th byte baud rate modification data (see table 18-4) - 9600 bps 9600 bps - ok: echo back data error: a1h u 3, a3h u 3, 62h u 3 (note 1) 5th byte 6th byte operation command data (c0h) - modified baud rate modified baud rate - ok: echo back data (c0h) error: a1h u 3, a3h u 3, 63h u 3 (note 1) 7th byte modified baud rate 3ah start mark 8th byte modified baud rate 0ah the number of transfer data (from 9th to 18th bytes) 9th byte modified baud rate 02h length of address (2 bytes) 10th byte modified baud rate 1dh reserved data 11th byte modified baud rate 00h reserved data 12th byte modified baud rate 00h reserved data 13th byte modified baud rate 00h reserved data 14th byte modified baud rate 01h rom block count (1 block) 15th byte modified baud rate 10h first address of rom (upper byte) 16th byte modified baud rate 00h first address of rom (lower byte) 17th byte modified baud rate ffh end address of rom (upper byte) 18th byte modified baud rate ffh end address of rom (lower byte) 19th byte modified baud rate d2h checksum of transferred data (9th through 18th byte) 20th byte (wait for the next operation command data) modified baud rate -
page 233 TMP86FS28FG 5. after sending the checksum, the device waits for the next operation command data.
page 234 18. serial prom mode 18.6 operation mode TMP86FS28FG 18.6.5 flash memory status out put mode (operati on command: c3h) table 18-11 shows flash memory status output mode process. note 1: ?xxh u 3? indicates that the device enters the halt condition after sending 3 bytes of xxh. for details, refer to " 18.7 error code ". note 2: for the details on status code 1, refer to " 18.12 flash memory status code ". description of flash memory status output mode 1. the 1st through 4th bytes of the transmitted and r eceived data contain the same data as in the flash memory writing mode. 2. the 5th byte of the received data contains the flash memory status output mode command data (c3h). 3. when the 5th byte contains the operation command data shown in table 18-6, the device echoes back the value which is the same data in the 6th byte positio n of the received data (i n this case, c3h). if the 5th byte does not contain the operation command data, the device enters the halt condition after send- ing 3 bytes of operation command error code (63h). 4. the 9th through 13th bytes contain the status code. for details on the status code, refer to " 18.12 flash memory status code ". 5. after sending the status code, the device wa its for the next operation command data. table 18-11 flash memory status output mode process transfer bytes transfer data from external con- troller to TMP86FS28FG baud rate transfer data from TMP86FS28FG to exter- nal controller boot rom 1st byte 2nd byte matching data (5ah) - 9600 bps 9600 bps - (automatic baud rate adjustment) ok: echo back data (5ah) error: nothing transmitted 3rd byte 4th byte baud rate modification data (see table 18-4) - 9600 bps 9600 bps - ok: echo back data error: a1h u 3, a3h u 3, 62h u 3 (note 1) 5th byte 6th byte operation command data (c3h) - modified baud rate modified baud rate - ok: echo back data (c3h) error: a1h u 3, a3h u 3, 63h u 3 (note 1) 7th byte modified baud rate 3ah start mark 8th byte modified baud rate 04h byte count (from 9th to 12th byte) 9th byte modified baud rate 00h to 03h status code 1 10th byte modified baud rate 00h reserved data 11th byte modified baud rate 00h reserved data 12th byte modified baud rate 00h reserved data 13th byte modified baud rate checksum 2?s complement for the sum of 9th through 12th bytes 9th byte checksum 00h: 00h 01h: ffh 02h: feh 03h: fdh 14th byte (wait for the next operation com- mand data) modified baud rate -
page 235 TMP86FS28FG 18.6.6 flash memory read protection setting mode (operation command: fah) table 18-12 shows flash memory read protection setting mode process. note 1: ?xxh u 3? indicates that the device enters the halt condition after sending 3 bytes of xxh. for details, refer to " 18.7 error code ". note 2: refer to " 18.10 passwords ". note 3: if the read protection is enabled for a blank product or a password error occurs for a non-blank product, TMP86FS28FG stops uart communication and enters the halt mode. in this case, initialize TMP86FS28FG by the reset pin and reacti- vate the serial prom mode. note 4: if an error occurs during reception of a password addr ess or a password string, TMP86FS28FG stops uart communica- tion and enters the halt mode. in this case, initialize TMP86FS28FG by the reset pin and reactivate the serial prom mode. description of the flash memory read protection setting mode 1. the 1st through 4th bytes of the transmitted and r eceived data contain the same data as in the flash memory writing mode. 2. the 5th byte of the received data contains the command data in th e flash memory status output mode (fah). 3. when the 5th byte of the received data contains the operation command data shown in table 1-6, the device echoes back the value which is the same data in the 6th byte position of the received data (in table 18-12 flash memory read protection setting mode process transfer bytes transfer data from external con- troller to TMP86FS28FG baud rate transfer data from TMP86FS28FG to exter- nal controller boot rom 1st byte 2nd byte matching data (5ah) - 9600 bps 9600 bps - (automatic baud rate adjustment) ok: echo back data (5ah) error: nothing transmitted 3rd byte 4th byte baud rate modification data (see table 18-4) - 9600 bps 9600 bps - ok: echo back data error: a1h u 3, a3h u 3, 62h u 3 (note 1) 5th byte 6th byte operation command data (fah) - modified baud rate modified baud rate - ok: echo back data (fah) error: a1h u 3, a3h u 3, 63h u 3 (note 1) 7th byte 8th byte password count storage address 15 to 08 (note 2) modified baud rate modified baud rate - ok: nothing transmitted error: nothing transmitted 9th byte 10th byte password count storage address 07 to 00 (note 2) modified baud rate modified baud rate - ok: nothing transmitted error: nothing transmitted 11th byte 12th byte password comparison start address 15 to 08 (note 2) modified baud rate modified baud rate - ok: nothing transmitted error: nothing transmitted 13th byte 14th byte password comparison start address 07 to 00 (note 2) modified baud rate modified baud rate - ok: nothing transmitted error: nothing transmitted 15th byte : m?th byte password string (note 2) - modified baud rate modified baud rate - ok: nothing transmitted error: nothing transmitted n?th byte - modified baud rate ok: fbh (note 3) error: nothing transmitted n?+1th byte (wait for the next operation com- mand data) modified baud rate -
page 236 18. serial prom mode 18.6 operation mode TMP86FS28FG this case, fah). if the 5th byte does not contai n the operation command data, the device enters the halt condition after transmitting 3 bytes of operation command error code (63h). 4. the 7th through m?th bytes of the transmitted and received data contai n the same data as in the flash memory writing mode. 5. the n'th byte contains the status to be transmitted to the external controller in the case of the success- ful read protection.
page 237 TMP86FS28FG 18.7 error code when detecting an error, the device tr ansmits the error code to the external controller, as shown in table 18-13. note: if a password error occurs, TMP86FS28FG does not transmit an error code. 18.8 checksum (sum) 18.8.1 calculation method the checksum (sum) is calculated with the sum of all bytes, and the obtain ed result is returned as a word. the data is read for each byte unit and th e calculated result is returned as a word. example: the checksum which is transmitted by executing the fl ash memory write comma nd or flash memory sum output command is calculated in the manner, as shown above. table 18-13 error code transmit data meaning of error data 62h, 62h, 62h baud rate modification error. 63h, 63h, 63h operation command error. a1h, a1h, a1h framing error in the received data. a3h, a3h, a3h overrun error in the received data. a1h if the data to be calculated consists of the four bytes, the checksum of the data is as shown below. b2h a1h + b2h + c3h + d4h = 02eah sum (high)= 02h sum (low)= eah c3h d4h
page 238 18. serial prom mode 18.8 checksum (sum) TMP86FS28FG 18.8.2 calculation data the data used to calculate the ch ecksum is listed in table 18-14. table 18-14 checksum calculation data operating mode calculation data description flash memory writing mode data in the entire area of the flash memory even when a part of the flash memory is written, the checksum of the entire flash memory ar ea (1000h to fffh) is calculated. the data length, address, record type and checksum in intel hex format are not included in the checksum. flash memory sum output mode product id code output mode 9th through 18th bytes of the transferred data for details, refer to " 18.11 product id code ". flash memory status output mode 9th through 12th bytes of the tran sferred data for details, refer to " 18.12 flash memory status code " flash memory erasing mode all data in the erased area of the flash memory (the whole or part of the flash memory) when the sector erase is exec uted, only the erased area is used to calculate the checksum. in the case of the chip erase, an entire area of the flash memory is used.
page 239 TMP86FS28FG 18.9 intel hex format (binary) 1. after receiving the checksum of a data record, the device waits for the start mark (3ah ?:?) of the next data record. after receiving the checksum of a data reco rd, the device ignores the data except 3ah transmitted by the external controller. 2. after transmitting the checksum of en d record, the external controller mu st transmit nothing, and wait for the 2-byte receive data (upper and lower bytes of the checksum). 3. if a receiving error or intel hex fo rmat error occurs, the device enters the halt condition without returning an error code to the external controller. the in tel hex format error occurs in the following case: when the record type is not 00h, 01h, or 02h when a checksum error occurs when the data length of an extended record (record type = 02h) is not 02h when the device receives the data reco rd after receiving an extended record (record type = 02h ) with extended address of 1000h or larger. when the data length of the end record (record type = 01h) is not 00h 18.10passwords the consecutive eight or mo re-byte data in the flash memory ar ea can be specified to the password. TMP86FS28FG compares the data string specified to the password with the password string transmitted from the external controller. the area in which passwords can be specified is locat ed at addresses 1000h to ff9fh. the area from ffa0h to ffffh can not be specified as the passwords area. if addresses from ffe0h through fff fh are filled with ?ffh?, the passw ords are not compared because the product is considered as a blank product. even in this case, the password count stor age addresses and password comparison start address must be specified. table 18-15 shows the password setting in the blank product and non- blank product. note 1: when addresses from ffe0h through ffffh are filled wi th ?ffh?, the product is re cognized as a blank product. note 2: the data including the same consecutive data (three or mo re bytes) can not be used as a password. (this causes a pass- word error data. TMP86FS28FG transmits no data and enters the halt condition.) note 3: *: don?t care. note 4: when the above condition is not met, a password error oc curs. if a password error occurs , the device enters the halt con - dition without returning the error code. note 5: in the flash memory writing mode, the blank product receives the intel hex form at data immediately after receiving pcsa without receiving password strings. in this case, the su bsequent processing is perform ed correctly because the blank product ignores the data except the start mark (3ah ?:?) as the intel hex format data, even if the external controller trans- mits the dummy password string. however, if the dummy passwo rd string contains ?3ah?, it is detected as the start mark erroneously. the microcontroller enters the halt mode. if this causes the problem, do not transmit the dummy password strings. note 6: in the flash memory erasing mode, t he external controller must not transmit the password string for the blank product. table 18-15 password setting in the blank product and non-blank product password blank product (note 1) non-blank product pnsa (password count storage address) 1000h d  pnsa d ff9fh 1000h d pnsa d ff9fh pcsa (password comparison start address) 1000h d pcsa d ff9fh 1000h d pcsa d ffa0 - n n (password count) *8 d n password string setting not required (note 5) required (note 2)
page 240 18. serial prom mode 18.10 passwords TMP86FS28FG figure 18-5 password comparison 18.10.1password string the password string transmitted from th e external controller is compared w ith the specified data in the flash memory. when the password string is not matched to the data in the flash memory, the device enters the halt condition due to the password error. 18.10.2handling of password error if a password error occurs, the device enters the halt c ondition. in this case, reset the device to reactivate the serial prom mode. 18.10.3password management during program development if a program is modified many times in the development stage, confusion may arise as to the password. therefore, it is recommended to use a fixed password in the program development stage. example :specify pnsa to f000h, and the pa ssword string to 8 bytes from address f001h (pcsa becomes f001h.) password section code abs = 0f000h db 08h : pnsa definition db ?code1234? : password string definition 08h 01h 02h 03h 04h 05h 08h f012h f107h f108h flash memory f109h f10ah f10bh f10ch uart f0h 12h f1h 07h 01h 02h 03h 04h 05h 06h 07h 08h pnsa pcsa password string 06h 07h f10dh f10eh "08h" becomes the umber of passwords 8 bytes compare example pnsa = f012h pcsa = f107h password string = 01h,02h,03h,04h,05h 06h,07h,08h rxd pin
page 241 TMP86FS28FG 18.11product id code the product id code is the 13-byte data containing the start address and the end address of rom. table 18-16 shows the product id code format. 18.12flash memory status code the flash memory status code is the 7-byte data including the read protection status and the status of the data from ffe0h to ffffh. table 18-17 shows the flash memory status code. table 18-16 product id code format data description in the case of TMP86FS28FG 1st start mark (3ah) 3ah 2nd the number of transfer data (10 bytes from 3rd to 12th byte) 0ah 3rd address length (2 bytes) 02h 4th reserved data 1dh 5th reserved data 00h 6th reserved data 00h 7th reserved data 00h 8th rom block count 01h 9th the first address of rom (upper byte) 10h 10th the first address of rom (lower byte) 00h 11th the end address of rom (upper byte) ffh 12th the end address of rom (lower byte) ffh 13th checksum of the transferred data (2?s compliment for the sum of 3rd through 12th bytes) d2h table 18-17 flash memory status code data description in the case of TMP86FS28FG 1st start mark 3ah 2nd transferred data count (3rd through 6th byte) 04h 3rd status code 00h to 03h (see figure below) 4th reserved data 00h 5th reserved data 00h 6th reserved data 00h 7th checksum of the transferred data (2?s compliment for the sum of 3rd through 6th data) 3rd byte 00h 01h 02h 03h checksum 00h ffh feh fdh status code 1 76543210 rpena blank (initial value: 0000 00**)
page 242 18. serial prom mode 18.12 flash memory status code TMP86FS28FG some operation commands are limited by the flash memory stat us code 1. if the read pr otection is enabled, flash memory writing mode command can not be executed. er ase all flash memory before executing these command. note: m : the command can be executed. pass: the command can be executed with a password. u : the command can not be executed. (after echoing the command back to the exter nal controller, TMP86FS28FG stops uart communication and enters the halt condition.) rpena flash memory read pro- tection status 0: 1: read protection is disabled. read protection is enabled. blank the status from ffe0h to ffffh. 0: 1: all data is ffh in the area from ffe0h to ffffh. the value except ffh is included in the area from ffe0h to ffffh. rpena blank flash memory writing mode flash memory sum output mode product id code output mode flash memory status output mode flash memory erasing mode read protec- tion setting mode chip erase sec- tor erase 00 mmmmm u 01 pass mmm pass pass 10 u mmmm uu 11 u mmm pass u pass
page 243 TMP86FS28FG 18.13specifying the erasure area in the flash memory erasing m ode, the erasure area of the flas h memory is specified by n  2 byte data. the start address of an erasure area is specified by erasta, and the end address is specified by eraend. if erasta is equal to or smaller than eraend, the sector erase (erasure in 4 kbyte units) is executed. executing the sector erase while the read protection is enabled results in an infinite loop. if erasta is larger than eraend, th e chip erase (erasure of an entire flash memory area) is executed and the read protection is disabled. therefore, execute the chip erase (not sector erase) to disable the read protection. note: when the sector erase is executed for the area contai ning no flash cell, TMP86FS28FG stops the uart communi- cation and enters the halt condition. erasure area specification data (n  2 byte data) 76543210 erasta eraend erasta the start address of the erasure area 0000: 0001: 0010: 0011: 0100: 0101: 0110: 0111: 1000: 1001: 1010: 1011: 1100: 1101: 1110: 1111: from 0000h from 1000h from 2000h from 3000h from 4000h from 5000h from 6000h from 7000h from 8000h from 9000h from a000h from b000h from c000h from d000h from e000h from f000h eraend the end address of the erasure area 0000: 0001: 0010: 0011: 0100: 0101: 0110: 0111: 1000: 1001: 1010: 1011: 1100: 1101: 1110: 1111: to 0fffh to 1fffh to 2fffh to 3fffh to 4fffh to 5fffh to 6fffh to 7fffh to 8fffh to 9fffh to afffh to bfffh to cfffh to dfffh to efffh to ffffh
page 244 18. serial prom mode 18.14 flowchart TMP86FS28FG 18.14flowchart start setup receive uart data receive data = 5ah adjust the baud rate (adjust the source clock to 9600 bps) no yes transmit uart data (transmit data = 5ah) receive uart data modify the baud rate based on the receive data receive data = 30h (flash memory writing mode) receive uart data (intel hex format) transmit uart data  (checksum of an entire area) receive uart data transmit uart data  (checksum of an entire area) receive data = c0h (product id code output mode) transmit uart data (transmit data = c0h) flash memory  write process transmit uart data  (product id code) transmit uart data (echo back the baud rate modification data) verify the password  (compare the receive  data and flash  memory data) read protection check protection disabled infinite loop ng receive data = c3h (flash memory status output mode) transmit uart data (transmit data = c3h) receive data = f0h (flash memory erasing mode) transmit uart data (transmit data = f0h) infinite loop ng chip erase (erase on entire area) transmit uart data  (checksum of an entire area) receive data = fah (read protection setting mode) transmit uart data (transmit data = fah) read protection setting read protection check blank product check infinite loop ng blank product check non-blank product ok blank product blank product check non-blank product ok ok blank product check non-blank product protection enable blank product disable read protection blank product receive uart data receive data sector erase (block erase) upper 4 bits x 1000h  to lower 4 bits x 1000h transmit uart data  (checksum of  the erased area) upper 4 bits > lower 4 bits transmit uart data (transmit data = 30h) transmit uart data (transmit data = 90h) receive data = 90h (flash memory sum output mode) verify the password  (compare the receive  data and flash  memory data) verify the password  (compare the receive  data and flash  memory data) transmit uart data  (status of the read protection  and blank product) transmit uart data  (transmit data = fbh) read protection check upper 4 bits < lower 4 bits protection enabled infinite loop protection disabled
page 245 TMP86FS28FG 18.15uart timing table 18-18 uart timing-1 (vdd = 4.5 to 5.5 v, fc = 2 to 16 mhz, topr = -10 to 40c) parameter symbol clock frequency (fc) minimum required time at fc = 2 mhz at fc = 16 mhz time from matching data reception to the echo back cmeb1 approx. 930 465 p s58.1 p s time from baud rate modification data reception to the echo back cmeb2 approx. 980 490 p s61.3 p s time from operation command reception to the echo back cmeb3 approx. 800 400 p s 50 p s checksum calculation time cksm approx. 7864500 3.93 s 491.5 p s erasure time of an entire flash memory ceall - 30 ms 30 ms erasure time for a sector of a flash memory (in 4-kbyte units) cesec - 15 ms 15 ms table 18-19 uart timing-2 (vdd = 4.5 to 5.5 v, fc = 2 to 16 mhz, topr = -10 to 40c) parameter symbol clock frequency (fc) minimum required time at fc = 2 mhz at fc = 16 mhz time from the reset release to the acceptance of start bit of rxd pin rxsup 2100 1.05 ms 131.3 ms matching data transmission interval cmtr1 28500 14.2 ms 1.78 ms time from the echo back of matching data to the acceptance of baud rate modification data cmtr2 380 190 p s 23.8 p s time from the echo back of baud rate modification data to the acceptance of an operation command cmtr3 650 325 p s 40.6 p s time from the echo back of operation command to the acceptance of password count storage addresses (upper byte) cmtr4 800 400 p s50 p s reset pin rxd pin rxsup (5ah) cmeb1 (5ah) cmtr2 (28h) (28h) cmeb2 cmtr3 (30h) (30h) cmeb3 cmtr4 txd pin rxd pin txd pin (5ah) (5ah) (5ah) cmtr1
page 246 18. serial prom mode 18.15 uart timing TMP86FS28FG


page 249 TMP86FS28FG 20. electrical characteristics 20.1 absolute maximum ratings the absolute maximum ratings are rated values which must not be exceeded during operat ion, even for an instant. any one of the ratings must not be exceeded. if any absolute maximum rati ng is exceeded, a device may break down or its performance may be degraded, causi ng it to catch fire or explode resul ting in injury to the user. thus, when designing products which include this de vice, ensure that no absolute maximu m rating value will ever be exceeded. (v ss = 0 v) parameter symbol pins ratings unit supply voltage v dd  0.3 to 6.5 v input voltage v in  0.3 to v dd + 0.3 output voltage v out  0.3 to v dd + 0.3 output current (per 1 pin) i ol1 p0,p1,p2,p3,p4,p5,p6,p7,p8 ports 3.2 ma i oh1 p0,p1,p3,p4,p5,p6,p7,p8 ports  1.8 output current (total) 6 i ol1 p0,p1,p2,p3,p4,p5,p6,p7,p8 ports 80 6 i oh1 p0,p1,p3,p4,p5,p6,p7,p8 ports  30 power dissipation [topr = 85 q c] p d 350 mw soldering temperature (time) tsld 260 (10 s) q c storage temperature tstg  55 to 125 operating temperature topr  40 to 85
page 250 20. electrical characteristics 20.2 operating condition TMP86FS28FG 20.2 operating condition the operating conditions show the conditions under which the device be used in orde r for it to operate normally while maintaining its quality. if the device is used outsid e the range of operating conditions (power supply voltage, operating temperature range, or ac/dc rated values), it may operate erratically. therefore, when designing your application equipment, always make sure its intended working conditio ns will not exceed th e range of operating conditions. 20.2.1 mcu mode (flash programming or erasing) 20.2.2 mcu mode (except flash programming or erasing) note 1: when the supply voltage is v dd < 3.0v, the operating tempreture is topr= -20 to 85 q c. (v ss = 0 v, topr = -10 to 40 q c) parameter symbol pins ratings min max unit supply voltage v dd normal1, 2 modes 4.5 5.5 v input high level v ih1 except hysteresis input v dd t 4.5 v v dd u 0.70 v dd v ih2 hysteresis input v dd u 0.75 input low level v il1 except hysteresis input v dd t 4.5 v 0 v dd u 0.30 v il2 hysteresis input v dd u 0.25 clock frequency fc xin, xout 1.0 16.0 mhz (v ss = 0 v, topr =  40 to 85 q c) parameter symbol pins condition min max unit supply voltage v dd fc = 16 mhz normal1, 2 mode 4.0 5.5 v idle0, 1, 2 mode fc = 8 mhz normal1, 2 mode 2.7(note1) idle0, 1, 2 mode fs = 32.768 khz slow1, 2 mode sleep0, 1, 2 mode stop mode input high level v ih1 except hysteresis input v dd t  4.5 v v dd u 0.70 v dd v ih2 hysteresis input v dd u 0.75 v ih3 v dd < 4.5 v v dd u 0.90 input low level v il1 except hysteresis input v dd t  4.5 v 0 v dd u 0.30 v il2 hysteresis input v dd u 0.25 v il3 v dd < 4.5 v v dd u 0.10 clock frequency fc xin, xout v dd = 2.7 v to 5.5 v 1.0 8.0 mhz v dd = 4.0 v to 5.5 v 16.0 fs xtin, xtout v dd = 2.7 v to 5.5 v 30.0 34.0 khz lcd reference voltage range v1 lcd booster circuit enable (v3 t v dd ) 0.9 1.8 v capacity for lcd booster circuit c lcd 0.1 0.47 uf
page 251 TMP86FS28FG 20.2.3 serial prom mode (v ss = 0 v, topr = -10 to 40 q c) parameter symbol pins condition min max unit supply voltage v dd normal1, 2 modes 4.5 5.5 v input high voltage v ih1 except hysteresis input v dd t 4.5 v v dd u 0.70 v dd v ih2 hysteresis input v dd u 0.75 input low voltage v il1 except hysteresis input v dd t 4.5 v 0 v dd u 0.30 v il2 hysteresis input v dd u 0.25 clock frequency fc xin, xout 2.0 16.0 mhz
page 252 20. electrical characteristics 20.3 dc characteristics TMP86FS28FG 20.3 dc characteristics note 1: typical values show those at topr = 25 q c, v dd = 5 v note 2: input current (i in1 , i in2 ); the current through pull-up or pull-down resistor is not included. note 3: i dd does not include i ref current. note 4: the supply currents of slow 2 and sleep 2 modes are equivalent to idle 0, 1, 2. note 5: when a program is executing in the flash memory or w hen data is being read from the flash memory, the flash memory operates in an intermittent manner, causing peak curr ents in the operation current, as shown in figure 20-1. in this case, the supply current i dd (in normal1, normal2 and slow1 modes) is defined as the sum of the average peak current and mcu current. note 6: when designing the power supply, make sure that p eak currents can be supplied. in slow1 mode, the difference between the peak current and the average current becomes large. figure 20-1 intermittent operation of flash memory (v ss = 0 v, topr =  40 to 85 q c) parameter symbol pins condition min typ. max unit hysteresis voltage v hs hysteresis input ? 0.9 ? v input current i in1 test v dd = 5.5 v, v in = 5.5 v/0 v ?? r 2 p a i in2 sink open drain, tri-state i in3 reset , stop input resistance r in2 reset pull-up v dd = 5.5 v, v in = 0 v 100 220 450 k : output leakage current i lo sink open drain, tri-state v dd = 5.5 v, v out = 5.5 v/0 v ?? r 2 p a output high voltage v oh c-mos, tri-st port v dd = 4.5 v, i oh =  0.7 ma 4.1 ? ? v output low voltage v ol except xout v dd = 4.5 v, i ol = 1.6 ma ??0.4 lcd output voltage use lcd driver?s booste v 2-3out v2 terminal v3 t v dd reference supply terminal :v1 seg/com terminal no load ?v1 x 2? v v3 terminal ?v1 x 3? supply current in normal 1, 2 mode i dd v dd = 5.5 v v in = 5.3/0.2 v fc = 16 mhz fs = 32.768 khz when a program operates on flash memory (note5,6) ? 15.5 16.5 ma supply current in idle 0, 1, 2 mode ?68.3 supply current in slow 1 mode v dd = 3.0 v v in = 2.8/0.2 v fs = 32.768 khz lcd drive is not enable. when a program operates on flash memory (note5,6) ?25260 p a when a program operates on ram ?2024 supply current in sleep 1 mode ?921 supply current in sleep 0 mode ?818 supply current in stop mode v dd = 5.5 v v in = 5.3 v/0.2 v ?0.510 n program coutner (pc) n+1 n+2 n+3 1 machine cycle (4/fc or 4/fs) mcu current i [ma] ddp-p typ. current momentary flash current max. current sum of average momentary flash current and mcu current
page 253 TMP86FS28FG 20.4 ad conversi on characteristics note 1: the total error includes all errors except a quantizati on error, and is defined as a maximum deviation from the ideal co n- version line. note 2: conversion time is different in recommended value by power supply voltage. about conversion time, please refe r to ?register configuration?. note 3: please use input voltage to ain input pin in limit of v aref to v ss . when voltage of range outside is input, conversion value becomes unsettled and gives affect to other channel conversion value. note 4: analog reference voltage range: ' v aref = v aref  v ss note 5: when ad is used with v dd < 2.7 v, the guaranteed temperature range varies with the operating voltage. note 6: the a vdd pin should be fixed on the v dd level even though ad converter is not used. (v ss = 0.0 v, 4.5 v d  v dd d  5.5 v, topr =  40 to 85 q c) parameter symbol condition min typ. max unit analog reference voltage v aref a vdd  1.0 ? a vdd v power supply voltage of analog control circuit (note6) a vdd v dd a vss v ss analog reference voltage range (note4) ' v aref 3.5 ? ? analog input voltage v ain a vss ? v aref power supply current of analog reference voltage i ref v dd = a vdd = v aref = 5.5 v v ss = a vss = 0.0 v ?0.61.0ma non linearity error v dd = a vdd = 5.0 v v ss = a vss = 0.0 v v aref = 5.0 v ?? r 2 lsb zero point error ?? r 2 full scale error ?? r 2 total error ?? r 2 (v ss = 0.0 v, 2.7 v d  v dd < 4.5 v, topr =  40 to 85 q c) parameter symbol condition min typ. max unit analog reference voltage v aref a vdd  1.0 ? a vdd v power supply voltage of analog control circuit (note6) a vdd v dd a vss v ss analog reference voltage range (note4) ' v aref 2.5 ? ? analog input voltage v ain v ss ? v aref power supply current of analog reference voltage i ref v dd = a vdd = v aref = 4.5 v v ss = a vss = 0.0 v ?0.50.8ma non linearity error v dd = a vdd = 2.7 v v ss = a vss = 0.0 v v aref = 2.7 v ?? r 2 lsb zero point error ?? r 2 full scale error ?? r 2 total error ?? r 2
page 254 20. electrical characteristics 20.5 ac characteristics TMP86FS28FG 20.5 ac characteristics note 1: when the supply voltage is v dd < 3.0v, the operating tempreture is topr= -20 to 85 q c. 20.6 flash characteristics (v ss = 0 v, v dd = 4.0 to 5.5 v, topr =  40 to 85 q c) parameter symbol condition min typ. max unit machine cycle time tcy normal1, 2 mode 0.25 ? 4 p s idle1, 2 mode slow1, 2 mode 117.6 ? 133.3 sleep1, 2 mode high level clock pulse width t wch for external clock operation (xin input) fc = 16 mhz ?31.25? ns low level clock pulse width t wcl high level clock pulse width t wch for external clock operation (xtin input) fs = 32.768 khz ?15.26? p s low level clock pulse width t wcl (v ss = 0 v, v dd = 2.7 to 5.5 v, topr =  40 to 85 q c) parameter symbol condition min typ. max unit machine cycle time tcy normal1, 2 mode 0.5 ? 4 p s idle1, 2 mode slow1, 2 mode 117.6 ? 133.3 sleep1, 2 mode high level clock pulse width t wch for external clock operation (xin input) fc = 8 mhz ? 62.5 ? ns low level clock pulse width t wcl high level clock pulse width t wch for external clock operation (xtin input) fs = 32.768 khz ?15.26? p s low level clock pulse width t wcl parameter condition min typ. max unit number of guaranteed writes to flash memory vss = 0 v, topr = -10 to 40 q c ? ? 100 times
page 255 TMP86FS28FG 20.7 recommended osc illating conditions note 1: to ensure stable oscillation, the resonator position, load capacitance, etc. must be appropriate. because these factors are greatly affected by board patterns, please be sure to evaluate operation on the board on which the device will act ually be mounted. note 2: for the resonators to be used with toshiba microcont rollers, we recommend ceramic resonators manufactured by murata manufacturing co., ltd. for details, please visit the website of murata at the following url: http://www.murata.com 20.8 handling precaution - the solderability test conditions for lead-free produc ts (indicated by the suffix g in product name) are shown below. 1. when using the sn-37pb solder bath solder bath temperature = 230 q c dipping time = 5 seconds number of times = once r-type flux used 2. when using the sn-3.0ag-0.5cu solder bath solder bath temperature = 245 q c dipping time = 5 seconds number of times = once r-type flux used note: the pass criteron of the above test is as follows: solderability rate until forming t 95 % - when using the device (oscillator) in places exposed to high electric fields such as cathode-ray tubes, we recommend electrically shielding the package in order to maintain normal operating condition.  

   

             
page 256 20. electrical characteristics 20.8 handling precaution TMP86FS28FG
page 257 TMP86FS28FG 21. package dimensions qfp80-p-1420-0.80b rev 01 unit: mm
page 258 21. package dimensions TMP86FS28FG
this is a technical document that de scribes the operating functi ons and electrical specif ications of the 8-bit microcontroller series tlcs-870/c (lsi). toshiba provides a variety of development tools a nd basic software to enable efficient software development. these development tools have specifi cations that support advances in microcomputer hardware (lsi) and can be used extensively. both the hardware and so ftware are supported continuous ly with version updates. the recent advances in cmos lsi production technology have be en phenomenal and microcomputer systems for lsi design are constant ly being improved. the products described in this document may also be revised in the future. be sure to check the latest specific ations before using. toshiba is developing highly integrated, high-perfo rmance microcomputers using advanced mos production technology and especially well proven cmos technology. we are prepared to meet the requests for custom packaging for a variet y of application areas. we are confident that our products can satisfy your application needs now and in the future.


▲Up To Search▲   

 
Price & Availability of TMP86FS28FG

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X